Trait argdata::Argdata[][src]

pub trait Argdata<'d> {
    fn serialize(
        &self,
        writer: &mut Write,
        fd_map: Option<&mut FdMapping>
    ) -> Result<()>;
fn serialized_length(&self) -> usize; fn read<'a>(&'a self) -> Result<Value<'a, 'd>, ReadError>
    where
        'd: 'a
, { ... }
fn get_type(&self) -> Result<Type, ReadError> { ... }
fn read_null(&self) -> Result<(), NotRead> { ... }
fn read_binary(&self) -> Result<&'d [u8], NotRead> { ... }
fn read_bool(&self) -> Result<bool, NotRead> { ... }
fn read_encoded_fd<'a>(
        &'a self
    ) -> Result<EncodedFd<&'a ConvertFd>, NotRead>
    where
        'd: 'a
, { ... }
fn read_float(&self) -> Result<f64, NotRead> { ... }
fn read_int_value(&self) -> Result<IntValue<'d>, NotRead> { ... }
fn read_map<'a>(&'a self) -> Result<&'a Map<'d>, NotRead>
    where
        'd: 'a
, { ... }
fn read_seq<'a>(&'a self) -> Result<&'a Seq<'d>, NotRead>
    where
        'd: 'a
, { ... }
fn read_str_value(&self) -> Result<StrValue<'d>, NotRead> { ... }
fn read_timestamp(&self) -> Result<Timespec, NotRead> { ... } }

An argdata value.

Note for implementers of this trait: Although all read methods have provided implementations, they are implemented in terms of eachother. You either need to provide:

  • the read() method, or
  • the get_type() method and implementations of all read_*() methods.

Do the latter if read() would do anything non-trivial, to keep things efficient.

get_type() and read_*() need to be consistent, which means that read_$TYPE() for the type returned by get_type() may not return an Err(NotRead::NoFit). Otherwise, read() will panic.

Required Methods

Serialize the argdata to the given writer.

Exactly self.serialized_bytes() bytes are written to the writer, if no error occurs.

File descriptors are mapped using fd_map. If it is None, encoded file descriptors will be kept as is, and actual file descriptors will be encoded as -1 (invalid).

The number of bytes that self.serialize() will write.

Provided Methods

Read the value.

Read the type of the value.

Check if the value is null.

Check if the value is a binary blob, and read it if it is.

Check if the value is a boolean, and read it if it is.

Check if the value is a file descriptor, and return it if it is.

Even though this function succeeds (returns an Ok()), converting the returned EncodedFd to an Fd might still fail.

Note: You probably want to use read_fd instead.

Check if the value is a float, and read it if it is.

Check if the value is an integer, and read it if it is.

Note: You might want to use read_int instead to directly get a primitive type like i32 or u64.

Check if the value is a map, and get access to it if it is.

Check if the value is a seq, and get access to it if it is.

Check if the value is a string, and read it if it is.

Note: You probably want to use read_str instead to directly get a &str.

Check if the value is a timestamp, and read it if it is.

Trait Implementations

impl<'a, 'd> Debug for Argdata<'d> + 'a
[src]

Formats the value using the given formatter. Read more

Implementors