Added id field.
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				MoreThanText/morethantext/pipeline/head There was a failure building this commit
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	MoreThanText/morethantext/pipeline/head There was a failure building this commit
				
			This commit is contained in:
		
							
								
								
									
										32
									
								
								src/fields/mod.rs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								src/fields/mod.rs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
use std::fmt;
 | 
			
		||||
use uuid::Uuid;
 | 
			
		||||
 | 
			
		||||
struct ID {
 | 
			
		||||
    data: Uuid,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl ID {
 | 
			
		||||
    fn new(id: Uuid) -> Self {
 | 
			
		||||
        Self {
 | 
			
		||||
            data: id,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl fmt::Display for ID {
 | 
			
		||||
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
 | 
			
		||||
        write!(f, "{}", self.data)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#[cfg(test)]
 | 
			
		||||
mod id {
 | 
			
		||||
    use super::*;
 | 
			
		||||
 | 
			
		||||
    #[test]
 | 
			
		||||
    fn id_new() {
 | 
			
		||||
        let data = Uuid::new_v4();
 | 
			
		||||
        let id = ID::new(data.clone());
 | 
			
		||||
        assert_eq!(id.to_string(), data.to_string());
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
mod client;
 | 
			
		||||
mod fields;
 | 
			
		||||
mod message;
 | 
			
		||||
mod router;
 | 
			
		||||
mod session;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user