pub enum Token<'a> {
}
Expand description
Binary token, the raw form of BinaryToken
This binary token contains the yielded raw tokens, and won’t match open and close tokens together, nor does it make a determination if open and close represents an array, object, or both.
Variants§
Open
‘{’
Close
‘}’
Equal
‘=’
U32(u32)
32bit unsigned integer
U64(u64)
64bit unsigned integer
I32(i32)
32bit signed integer
Bool(bool)
boolean
Quoted(Scalar<'a>)
quoted text
Unquoted(Scalar<'a>)
text that is not quoted
F32([u8; 4])
32bits of floating point data
F64([u8; 8])
64bits of floating point data
Rgb(Rgb)
Rgb data
I64(i64)
64bit signed integer
Id(u16)
token id that can be resolved to a string via a TokenResolver
Implementations§
source§impl<'a> Token<'a>
impl<'a> Token<'a>
sourcepub fn write(&self, wtr: impl Write) -> Result<(), Error>
pub fn write(&self, wtr: impl Write) -> Result<(), Error>
Write the binary representation of a token to a writer
use jomini::binary::Token;
let out = Vec::new();
let mut cursor = std::io::Cursor::new(out);
for token in &[Token::Id(0x00e1), Token::Equal, Token::U32(10)] {
token.write(&mut cursor)?;
}
assert_eq!(&cursor.into_inner(), &[0xe1, 0x00, 0x01, 0x00, 0x14, 0x00, 0x0a, 0x00, 0x00, 0x00]);
Trait Implementations§
source§impl<'a> PartialEq for Token<'a>
impl<'a> PartialEq for Token<'a>
impl<'a> Copy for Token<'a>
impl<'a> Eq for Token<'a>
impl<'a> StructuralPartialEq for Token<'a>
Auto Trait Implementations§
impl<'a> Freeze for Token<'a>
impl<'a> RefUnwindSafe for Token<'a>
impl<'a> Send for Token<'a>
impl<'a> Sync for Token<'a>
impl<'a> Unpin for Token<'a>
impl<'a> UnwindSafe for Token<'a>
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