Struct BorrowedCowField
pub struct BorrowedCowField;Expand description
An encoder for Cow<'a, str> or Cow<'a, [u8]> that creates
Cow::Borrowed on read.
Trait Implementations§
§impl DescribeField<Cow<'_, str>> for BorrowedCowField
 
impl DescribeField<Cow<'_, str>> for BorrowedCowField
§const FIELD_TYPE: FieldType<'static>
 
const FIELD_TYPE: FieldType<'static>
The type of the field.
§const PACKED_TYPE: Option<&'static str> = None
 
const PACKED_TYPE: Option<&'static str> = None
The type name of the field in a packed context.
§impl<'a, R> FieldDecode<'a, Cow<'a, [u8]>, R> for BorrowedCowField
 
impl<'a, R> FieldDecode<'a, Cow<'a, [u8]>, R> for BorrowedCowField
§fn read_field(
    item: &mut InplaceOption<'_, Cow<'a, [u8]>>,
    reader: FieldReader<'a, '_, R>,
) -> Result<(), Error>
 
fn read_field( item: &mut InplaceOption<'_, Cow<'a, [u8]>>, reader: FieldReader<'a, '_, R>, ) -> Result<(), Error>
Reads a field into 
item.§fn default_field(
    item: &mut InplaceOption<'_, Cow<'a, [u8]>>,
) -> Result<(), Error>
 
fn default_field( item: &mut InplaceOption<'_, Cow<'a, [u8]>>, ) -> Result<(), Error>
Instantiates 
item with its default value, if there is one. Read more§fn packed<'p, C>() -> Option<&'p dyn PackedDecode<'a, T, C>>where
    C: CopyExtend<T>,
    T: 'p,
 
fn packed<'p, C>() -> Option<&'p dyn PackedDecode<'a, T, C>>where
    C: CopyExtend<T>,
    T: 'p,
Unless 
packed()::must_pack() is true, the sequence decoder must detect
the encoding (packed or not) and call the appropriate method.§fn wrap_in_sequence() -> bool
 
fn wrap_in_sequence() -> bool
Returns whether this field is wrapped in a message when encoded nested
in a sequence (such as a repeated field).
§fn read_field_in_sequence(
    item: &mut InplaceOption<'_, T>,
    reader: FieldReader<'a, '_, R>,
) -> Result<(), Error>
 
fn read_field_in_sequence( item: &mut InplaceOption<'_, T>, reader: FieldReader<'a, '_, R>, ) -> Result<(), Error>
Reads this field that was encoded as part of a sequence, unwrapping it
from a message if necessary.
§const ENTRY: DecoderEntry<'a, T, R> = _
 
const ENTRY: DecoderEntry<'a, T, R> = _
The table decoder entry for this type, used in types from
table::decode. Read more§impl<'a, R> FieldDecode<'a, Cow<'a, str>, R> for BorrowedCowField
 
impl<'a, R> FieldDecode<'a, Cow<'a, str>, R> for BorrowedCowField
§fn read_field(
    item: &mut InplaceOption<'_, Cow<'a, str>>,
    reader: FieldReader<'a, '_, R>,
) -> Result<(), Error>
 
fn read_field( item: &mut InplaceOption<'_, Cow<'a, str>>, reader: FieldReader<'a, '_, R>, ) -> Result<(), Error>
Reads a field into 
item.§fn default_field(
    item: &mut InplaceOption<'_, Cow<'a, str>>,
) -> Result<(), Error>
 
fn default_field( item: &mut InplaceOption<'_, Cow<'a, str>>, ) -> Result<(), Error>
Instantiates 
item with its default value, if there is one. Read more§fn packed<'p, C>() -> Option<&'p dyn PackedDecode<'a, T, C>>where
    C: CopyExtend<T>,
    T: 'p,
 
fn packed<'p, C>() -> Option<&'p dyn PackedDecode<'a, T, C>>where
    C: CopyExtend<T>,
    T: 'p,
Unless 
packed()::must_pack() is true, the sequence decoder must detect
the encoding (packed or not) and call the appropriate method.§fn wrap_in_sequence() -> bool
 
fn wrap_in_sequence() -> bool
Returns whether this field is wrapped in a message when encoded nested
in a sequence (such as a repeated field).
§fn read_field_in_sequence(
    item: &mut InplaceOption<'_, T>,
    reader: FieldReader<'a, '_, R>,
) -> Result<(), Error>
 
fn read_field_in_sequence( item: &mut InplaceOption<'_, T>, reader: FieldReader<'a, '_, R>, ) -> Result<(), Error>
Reads this field that was encoded as part of a sequence, unwrapping it
from a message if necessary.
§const ENTRY: DecoderEntry<'a, T, R> = _
 
const ENTRY: DecoderEntry<'a, T, R> = _
The table decoder entry for this type, used in types from
table::decode. Read more§impl<'a, R> FieldEncode<Cow<'a, [u8]>, R> for BorrowedCowField
 
impl<'a, R> FieldEncode<Cow<'a, [u8]>, R> for BorrowedCowField
§fn write_field(item: Cow<'a, [u8]>, writer: FieldWriter<'_, '_, R>)
 
fn write_field(item: Cow<'a, [u8]>, writer: FieldWriter<'_, '_, R>)
Writes 
item as a field.§fn compute_field_size(item: &mut Cow<'a, [u8]>, sizer: FieldSizer<'_>)
 
fn compute_field_size(item: &mut Cow<'a, [u8]>, sizer: FieldSizer<'_>)
Computes the size of 
item as a field. Read more§fn packed<'a>() -> Option<&'a dyn PackedEncode<T>>where
    T: 'a,
 
fn packed<'a>() -> Option<&'a dyn PackedEncode<T>>where
    T: 'a,
Returns the encoder for writing multiple instances of this field in a
packed list, or 
None if there is no packed encoding for this type.§fn wrap_in_sequence() -> bool
 
fn wrap_in_sequence() -> bool
Returns whether this field should be wrapped in a message when encoded
nested in a sequence (such as a repeated field). Read more
§fn write_field_in_sequence(item: T, writer: &mut SequenceWriter<'_, '_, R>)
 
fn write_field_in_sequence(item: T, writer: &mut SequenceWriter<'_, '_, R>)
Writes this field as part of a sequence, wrapping it in a message if
necessary.
§fn compute_field_size_in_sequence(item: &mut T, sizer: &mut SequenceSizer<'_>)
 
fn compute_field_size_in_sequence(item: &mut T, sizer: &mut SequenceSizer<'_>)
Computes the size of this field as part of a sequence, including the
size of a wrapping message.
§const ENTRY: EncoderEntry<T, R> = _
 
const ENTRY: EncoderEntry<T, R> = _
The table encoder entry for this type, used in types from
table::encode. Read more§impl<'a, R> FieldEncode<Cow<'a, str>, R> for BorrowedCowField
 
impl<'a, R> FieldEncode<Cow<'a, str>, R> for BorrowedCowField
§fn write_field(item: Cow<'a, str>, writer: FieldWriter<'_, '_, R>)
 
fn write_field(item: Cow<'a, str>, writer: FieldWriter<'_, '_, R>)
Writes 
item as a field.§fn compute_field_size(item: &mut Cow<'a, str>, sizer: FieldSizer<'_>)
 
fn compute_field_size(item: &mut Cow<'a, str>, sizer: FieldSizer<'_>)
Computes the size of 
item as a field. Read more§fn packed<'a>() -> Option<&'a dyn PackedEncode<T>>where
    T: 'a,
 
fn packed<'a>() -> Option<&'a dyn PackedEncode<T>>where
    T: 'a,
Returns the encoder for writing multiple instances of this field in a
packed list, or 
None if there is no packed encoding for this type.§fn wrap_in_sequence() -> bool
 
fn wrap_in_sequence() -> bool
Returns whether this field should be wrapped in a message when encoded
nested in a sequence (such as a repeated field). Read more
§fn write_field_in_sequence(item: T, writer: &mut SequenceWriter<'_, '_, R>)
 
fn write_field_in_sequence(item: T, writer: &mut SequenceWriter<'_, '_, R>)
Writes this field as part of a sequence, wrapping it in a message if
necessary.
§fn compute_field_size_in_sequence(item: &mut T, sizer: &mut SequenceSizer<'_>)
 
fn compute_field_size_in_sequence(item: &mut T, sizer: &mut SequenceSizer<'_>)
Computes the size of this field as part of a sequence, including the
size of a wrapping message.
§const ENTRY: EncoderEntry<T, R> = _
 
const ENTRY: EncoderEntry<T, R> = _
The table encoder entry for this type, used in types from
table::encode. Read moreAuto Trait Implementations§
impl Freeze for BorrowedCowField
impl RefUnwindSafe for BorrowedCowField
impl Send for BorrowedCowField
impl Sync for BorrowedCowField
impl Unpin for BorrowedCowField
impl UnwindSafe for BorrowedCowField
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more