pub enum PrimitiveType {
None,
Char,
Int8,
Int16,
Int32,
Int64,
UInt8,
UInt16,
UInt32,
UInt64,
Float,
Double,
}Variants§
Implementations§
Source§impl PrimitiveType
impl PrimitiveType
pub const fn null_value(&self) -> &PrimitiveValue
pub const fn max_value(&self) -> &PrimitiveValue
pub const fn min_value(&self) -> PrimitiveValue
pub const fn name(&self) -> &'static str
Sourcepub const fn size(&self) -> usize
pub const fn size(&self) -> usize
Examples found in repository?
examples/dec.rs (line 81)
61 fn on_encoding(
62 &mut self,
63 field_token: &Token,
64 buffer: &[u8],
65 type_token: &Token,
66 acting_version: i32,
67 ) -> Result<(), TokenListenerError> {
68 // println!(" {name}: {{{}}} {p:?} = {buffer:02X?}", p.to_string());
69 self.print_scope();
70 if self.composite_level > 0 {
71 print!("{}", type_token.name);
72 } else {
73 print!("{}", field_token.name);
74 }
75
76 let np = self.const_or_not_present_value(type_token, field_token.version, acting_version);
77 if np.is_none() {
78 println!(
79 "={} : {buffer:02X?}",
80 buffer
81 .chunks(type_token.encoding.primitive_type.size())
82 .map(|b| format!(
83 "{}",
84 PrimitiveValue::new(type_token.encoding.primitive_type, b)
85 ))
86 .collect::<Vec<_>>()
87 .join(", ")
88 );
89 } else {
90 print!("={np}");
91 for _ in 1..type_token.array_length() {
92 print!(", {np}");
93 }
94 println!(" [const]")
95 }
96
97 Ok(())
98 }Trait Implementations§
Source§impl Clone for PrimitiveType
impl Clone for PrimitiveType
Source§fn clone(&self) -> PrimitiveType
fn clone(&self) -> PrimitiveType
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PrimitiveType
impl Debug for PrimitiveType
Source§impl Display for PrimitiveType
impl Display for PrimitiveType
Source§impl PartialEq for PrimitiveType
impl PartialEq for PrimitiveType
impl Copy for PrimitiveType
impl Eq for PrimitiveType
impl StructuralPartialEq for PrimitiveType
Auto Trait Implementations§
impl Freeze for PrimitiveType
impl RefUnwindSafe for PrimitiveType
impl Send for PrimitiveType
impl Sync for PrimitiveType
impl Unpin for PrimitiveType
impl UnsafeUnpin for PrimitiveType
impl UnwindSafe for PrimitiveType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more