Trait flep_protocol::argument::Argument
[−]
[src]
pub trait Argument: Sized { fn read(read: &mut BufRead) -> Result<Self, Error>; fn write(&self, write: &mut Write) -> Result<(), Error>; fn read_with_space(read: &mut BufRead) -> Result<Self, Error> { ... } fn parse_text(text: &str) -> Self { ... } fn bytes(&self) -> Vec<u8> { ... } fn to_string(&self) -> String { ... } }
An argument to a command.
Required Methods
fn read(read: &mut BufRead) -> Result<Self, Error>
fn write(&self, write: &mut Write) -> Result<(), Error>
Provided Methods
fn read_with_space(read: &mut BufRead) -> Result<Self, Error>
Read an argument with a leading space character.
Most argument types don't care about leading spaces. These
types can instead override read
.
fn parse_text(text: &str) -> Self
fn bytes(&self) -> Vec<u8>
fn to_string(&self) -> String
Implementors
impl Argument for String
impl Argument for u8
impl Argument for i8
impl Argument for u16
impl Argument for i16
impl Argument for u32
impl Argument for i32
impl Argument for u64
impl Argument for i64
impl<T: Argument> Argument for Option<T>
impl Argument for Mode
impl Argument for FileType
impl Argument for TextFormat