Struct protobuf_codec::field::Optional [] [src]

pub struct Optional<T>(_);

Decoder and encoder for optinal fields.

Methods

impl<T> Optional<T>
[src]

[src]

Makes a new Optional instance.

[src]

Returns a reference to the inner field encoder/decoder.

[src]

Returns a mutable reference to the inner field encoder/decoder.

[src]

Takes the ownership of the instance, and returns the inner field encoder/decoder.

Trait Implementations

impl<T: Debug> Debug for Optional<T>
[src]

[src]

Formats the value using the given formatter. Read more

impl<T: Default> Default for Optional<T>
[src]

[src]

Returns the "default value" for a type. Read more

impl<D: RequiredFieldDecode> Decode for Optional<D>
[src]

The type of items to be decoded.

[src]

Consumes the given buffer (a part of a byte sequence), and proceeds the decoding process. Read more

[src]

Returns true if there are no items to be decoded by the decoder at the next invocation of decode method, otherwise false. Read more

[src]

Finishes the current decoding process and returns the decoded item. Read more

[src]

Returns the lower bound of the number of bytes needed to decode the next item. Read more

impl<D: RequiredFieldDecode> FieldDecode for Optional<D>
[src]

[src]

Tries to start decoding a field. Read more

impl<E: RequiredFieldEncode> Encode for Optional<E>
[src]

The type of items to be encoded.

[src]

Encodes the items in the encoder and writes the encoded bytes to the given buffer. Read more

[src]

Tries to start encoding the given item. Read more

[src]

Returns true if there are no items to be encoded in the encoder, otherwise false. Read more

[src]

Returns the number of bytes required to encode all the items in the encoder. Read more

impl<E: RequiredFieldEncode + SizedEncode> SizedEncode for Optional<E>
[src]

[src]

Returns the exact number of bytes required to encode all the items remaining in the encoder.

impl<E: RequiredFieldEncode> FieldEncode for Optional<E>
[src]

Auto Trait Implementations

impl<T> Send for Optional<T> where
    T: Send

impl<T> Sync for Optional<T> where
    T: Sync