Skip to main content

ParseValue

Trait 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§

Source

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".

Implementations on Foreign Types§

Source§

impl ParseValue for f32

Source§

fn parse(bytes: &[u8]) -> (Self, usize)

Source§

impl ParseValue for f64

Source§

fn parse(bytes: &[u8]) -> (Self, usize)

Source§

impl ParseValue for i8

Source§

fn parse(bytes: &[u8]) -> (Self, usize)

Source§

impl ParseValue for i16

Source§

fn parse(bytes: &[u8]) -> (Self, usize)

Source§

impl ParseValue for i32

Source§

fn parse(bytes: &[u8]) -> (Self, usize)

Source§

impl ParseValue for i64

Source§

fn parse(bytes: &[u8]) -> (Self, usize)

Source§

impl ParseValue for i128

Source§

fn parse(bytes: &[u8]) -> (Self, usize)

Source§

impl ParseValue for isize

Source§

fn parse(bytes: &[u8]) -> (Self, usize)

Source§

impl ParseValue for u8

Source§

fn parse(bytes: &[u8]) -> (Self, usize)

Source§

impl ParseValue for u16

Source§

fn parse(bytes: &[u8]) -> (Self, usize)

Source§

impl ParseValue for u32

Source§

fn parse(bytes: &[u8]) -> (Self, usize)

Source§

impl ParseValue for u64

Source§

fn parse(bytes: &[u8]) -> (Self, usize)

Source§

impl ParseValue for u128

Source§

fn parse(bytes: &[u8]) -> (Self, usize)

Source§

impl ParseValue for ()

Source§

fn parse(_bytes: &[u8]) -> (Self, usize)

Source§

impl ParseValue for usize

Source§

fn parse(bytes: &[u8]) -> (Self, usize)

Implementors§