feat(tvix/nix-compat): Add nix serialization support
This change implements the serialization part that is needed to implement the nix daemon protocol. Previously was add deserialization and derivers for that and this then adds the other part of that equation so that you can write types that can then be read using deserialization. Change-Id: I2917de634980a93822a4f5a8ad38897b9ce16d89 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12729 Autosubmit: Brian Olsen <me@griff.name> Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
This commit is contained in:
		
							parent
							
								
									6582fa69f1
								
							
						
					
					
						commit
						b88579ade4
					
				
					 20 changed files with 2339 additions and 15 deletions
				
			
		| 
						 | 
				
			
			@ -181,7 +181,7 @@ pub async fn write_bytes<W: AsyncWriteExt + Unpin, B: AsRef<[u8]>>(
 | 
			
		|||
 | 
			
		||||
/// Computes the number of bytes we should add to len (a length in
 | 
			
		||||
/// bytes) to be aligned on 64 bits (8 bytes).
 | 
			
		||||
fn padding_len(len: u64) -> u8 {
 | 
			
		||||
pub(crate) fn padding_len(len: u64) -> u8 {
 | 
			
		||||
    let aligned = len.wrapping_add(7) & !7;
 | 
			
		||||
    aligned.wrapping_sub(len) as u8
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue