pub trait ParseValue: Default + Sized {
// Required method
fn parse(bytes: &[u8]) -> (Self, usize);
}Expand description
Used by input formats to read node or edge values from bytes.
Required Methods§
Sourcefn parse(bytes: &[u8]) -> (Self, usize)
fn parse(bytes: &[u8]) -> (Self, usize)
Parses a value from a slice.
§Example
use fso_graph_builder::input::ParseValue;
let bytes = "13.37".as_bytes();
let (number, len) = f32::parse(bytes);
assert_eq!(number, 13.37);
assert_eq!(len, 5);§Return
Returns a tuple containing two entries. The first is the parsed value, the second is the index of the byte right after the parsed value.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".