Trait graph::prelude::ParseValue
source · 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 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.
Object Safety§
This trait is not object safe.