feat(tvix/value): implement Display properly for lists
Change-Id: I991d235cf52fbd42eb839b384f9c55ee64fa86c4 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6100 Tested-by: BuildkiteCI Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
		
							parent
							
								
									56caaf70ca
								
							
						
					
					
						commit
						2dcbbb8c4a
					
				
					 1 changed files with 8 additions and 2 deletions
				
			
		| 
						 | 
					@ -8,7 +8,13 @@ pub struct NixList(pub Vec<Value>);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl Display for NixList {
 | 
					impl Display for NixList {
 | 
				
			||||||
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
 | 
					    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
 | 
				
			||||||
        // TODO(tazjin): format lists properly
 | 
					        f.write_str("[ ")?;
 | 
				
			||||||
        f.write_fmt(format_args!("<list({})>", self.0.len()))
 | 
					
 | 
				
			||||||
 | 
					        for v in &self.0 {
 | 
				
			||||||
 | 
					            v.fmt(f)?;
 | 
				
			||||||
 | 
					            f.write_str(" ")?;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        f.write_str("]")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue