Skip to main content

MutableField

Trait MutableField 

Source
pub trait MutableField<'a>: Clone + Default {
    // Required methods
    fn decode(field: FieldView<'a>) -> Option<Self>;
    fn detect(field: FieldView<'a>) -> Option<&'a [u32]>;
    fn encode(&self, buffer: &mut Buffer) -> Result<Unit, MutableError>;

    // Provided methods
    fn folds_when_present() -> bool
       where Self: Sized { ... }
    fn is_empty_field(&self) -> bool { ... }
    fn omits_default_after_encode() -> bool
       where Self: Sized { ... }
    fn is_dirty(&self) -> bool { ... }
    fn has_nested_dirty(&self) -> bool { ... }
}
Expand description

Encoding and dirty-tracking contract implemented by mutable field values.

This trait is primarily implemented by generated bindings. Application code normally interacts with the generated field accessors instead.

Required Methods§

Source

fn decode(field: FieldView<'a>) -> Option<Self>

Source

fn detect(field: FieldView<'a>) -> Option<&'a [u32]>

Source

fn encode(&self, buffer: &mut Buffer) -> Result<Unit, MutableError>

Provided Methods§

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<'a, T: MutableField<'a>> MutableField<'a> for Box<T>

Source§

fn decode(field: FieldView<'a>) -> Option<Self>

Source§

fn detect(field: FieldView<'a>) -> Option<&'a [u32]>

Source§

fn encode(&self, buffer: &mut Buffer) -> Result<Unit, MutableError>

Source§

fn is_dirty(&self) -> bool

Source§

fn has_nested_dirty(&self) -> bool

Source§

impl<'a> MutableField<'a> for String

Source§

fn decode(field: FieldView<'a>) -> Option<Self>

Source§

fn detect(field: FieldView<'a>) -> Option<&'a [u32]>

Source§

fn is_empty_field(&self) -> bool

Source§

fn omits_default_after_encode() -> bool
where Self: Sized,

Source§

fn encode(&self, buffer: &mut Buffer) -> Result<Unit, MutableError>

Source§

impl<'a> MutableField<'a> for Vec<u8>

Source§

fn decode(field: FieldView<'a>) -> Option<Self>

Source§

fn detect(field: FieldView<'a>) -> Option<&'a [u32]>

Source§

fn is_empty_field(&self) -> bool

Source§

fn omits_default_after_encode() -> bool
where Self: Sized,

Source§

fn encode(&self, buffer: &mut Buffer) -> Result<Unit, MutableError>

Source§

impl<'a> MutableField<'a> for bool

Source§

fn decode(field: FieldView<'a>) -> Option<Self>

Source§

fn detect(field: FieldView<'a>) -> Option<&'a [u32]>

Source§

fn folds_when_present() -> bool
where Self: Sized,

Source§

fn is_empty_field(&self) -> bool

Source§

fn omits_default_after_encode() -> bool
where Self: Sized,

Source§

fn encode(&self, _buffer: &mut Buffer) -> Result<Unit, MutableError>

Source§

impl<'a> MutableField<'a> for f32

Source§

fn decode(field: FieldView<'a>) -> Option<Self>

Source§

fn detect(field: FieldView<'a>) -> Option<&'a [u32]>

Source§

fn folds_when_present() -> bool
where Self: Sized,

Source§

fn is_empty_field(&self) -> bool

Source§

fn omits_default_after_encode() -> bool
where Self: Sized,

Source§

fn encode(&self, _buffer: &mut Buffer) -> Result<Unit, MutableError>

Source§

impl<'a> MutableField<'a> for f64

Source§

fn decode(field: FieldView<'a>) -> Option<Self>

Source§

fn detect(field: FieldView<'a>) -> Option<&'a [u32]>

Source§

fn folds_when_present() -> bool
where Self: Sized,

Source§

fn is_empty_field(&self) -> bool

Source§

fn omits_default_after_encode() -> bool
where Self: Sized,

Source§

fn encode(&self, _buffer: &mut Buffer) -> Result<Unit, MutableError>

Source§

impl<'a> MutableField<'a> for i32

Source§

fn decode(field: FieldView<'a>) -> Option<Self>

Source§

fn detect(field: FieldView<'a>) -> Option<&'a [u32]>

Source§

fn folds_when_present() -> bool
where Self: Sized,

Source§

fn is_empty_field(&self) -> bool

Source§

fn omits_default_after_encode() -> bool
where Self: Sized,

Source§

fn encode(&self, _buffer: &mut Buffer) -> Result<Unit, MutableError>

Source§

impl<'a> MutableField<'a> for i64

Source§

fn decode(field: FieldView<'a>) -> Option<Self>

Source§

fn detect(field: FieldView<'a>) -> Option<&'a [u32]>

Source§

fn folds_when_present() -> bool
where Self: Sized,

Source§

fn is_empty_field(&self) -> bool

Source§

fn omits_default_after_encode() -> bool
where Self: Sized,

Source§

fn encode(&self, _buffer: &mut Buffer) -> Result<Unit, MutableError>

Source§

impl<'a> MutableField<'a> for u32

Source§

fn decode(field: FieldView<'a>) -> Option<Self>

Source§

fn detect(field: FieldView<'a>) -> Option<&'a [u32]>

Source§

fn folds_when_present() -> bool
where Self: Sized,

Source§

fn is_empty_field(&self) -> bool

Source§

fn omits_default_after_encode() -> bool
where Self: Sized,

Source§

fn encode(&self, _buffer: &mut Buffer) -> Result<Unit, MutableError>

Source§

impl<'a> MutableField<'a> for u64

Source§

fn decode(field: FieldView<'a>) -> Option<Self>

Source§

fn detect(field: FieldView<'a>) -> Option<&'a [u32]>

Source§

fn folds_when_present() -> bool
where Self: Sized,

Source§

fn is_empty_field(&self) -> bool

Source§

fn omits_default_after_encode() -> bool
where Self: Sized,

Source§

fn encode(&self, _buffer: &mut Buffer) -> Result<Unit, MutableError>

Implementors§

Source§

impl<'a, K: MutableMapKey<'a>, V: MutableField<'a>> MutableField<'a> for MutableMap<'a, K, V>

Source§

impl<'a, T: MutableArrayElement<'a>> MutableField<'a> for MutableArray<'a, T>