pub struct Ref<'a>(_);
Expand description
A partly owned value.
This buffer allows strings to be borrowed internally.
Implementations§
source§impl<'a> Ref<'a>
impl<'a> Ref<'a>
sourcepub fn str(v: &'a impl Borrow<str> + ?Sized) -> Self
pub fn str(v: &'a impl Borrow<str> + ?Sized) -> Self
Create a buffer for a borrowed string value.
sourcepub fn owned_bytes(v: impl Into<Vec<u8>>) -> Self
pub fn owned_bytes(v: impl Into<Vec<u8>>) -> Self
Create a buffer for an owned byte-string value.
sourcepub fn bytes(v: &'a impl Borrow<[u8]> + ?Sized) -> Self
pub fn bytes(v: &'a impl Borrow<[u8]> + ?Sized) -> Self
Create a buffer for a borrowed byte-string value.
sourcepub fn unit_struct(name: &'static str) -> Self
pub fn unit_struct(name: &'static str) -> Self
Create a buffer for a unit struct, like struct A
.
sourcepub fn newtype_struct(name: &'static str, value: impl Into<Ref<'a>>) -> Self
pub fn newtype_struct(name: &'static str, value: impl Into<Ref<'a>>) -> Self
Create a buffer for a newtype struct, like struct A(T)
.
sourcepub fn record_struct(
name: &'static str,
fields: impl IntoIterator<Item = (&'static str, Ref<'a>)>
) -> Self
pub fn record_struct( name: &'static str, fields: impl IntoIterator<Item = (&'static str, Ref<'a>)> ) -> Self
Create a buffer for a struct with named fields, like struct A { a: T, b: U }
.
sourcepub fn tuple_struct(
name: &'static str,
fields: impl IntoIterator<Item = Ref<'a>>
) -> Self
pub fn tuple_struct( name: &'static str, fields: impl IntoIterator<Item = Ref<'a>> ) -> Self
Create a buffer for a struct with unnamed fields, like struct A(T, U)
.
sourcepub fn tuple(fields: impl IntoIterator<Item = Ref<'a>>) -> Self
pub fn tuple(fields: impl IntoIterator<Item = Ref<'a>>) -> Self
Create a buffer for a tuple, like (T, U)
.
sourcepub fn unit_variant(
name: &'static str,
variant_index: u32,
variant: &'static str
) -> Self
pub fn unit_variant( name: &'static str, variant_index: u32, variant: &'static str ) -> Self
Create a buffer for a unit enum variant, like A::B
.
sourcepub fn newtype_variant(
name: &'static str,
variant_index: u32,
variant: &'static str,
value: impl Into<Ref<'a>>
) -> Self
pub fn newtype_variant( name: &'static str, variant_index: u32, variant: &'static str, value: impl Into<Ref<'a>> ) -> Self
Create a buffer for a newtype enum variant, like A::B(T)
.
sourcepub fn tuple_variant(
name: &'static str,
variant_index: u32,
variant: &'static str,
fields: impl IntoIterator<Item = Ref<'a>>
) -> Self
pub fn tuple_variant( name: &'static str, variant_index: u32, variant: &'static str, fields: impl IntoIterator<Item = Ref<'a>> ) -> Self
Create a buffer for an enum variant with unnamed fields, like A::B(T, U)
.
sourcepub fn record_struct_variant(
name: &'static str,
variant_index: u32,
variant: &'static str,
fields: impl IntoIterator<Item = (&'static str, Ref<'a>)>
) -> Self
pub fn record_struct_variant( name: &'static str, variant_index: u32, variant: &'static str, fields: impl IntoIterator<Item = (&'static str, Ref<'a>)> ) -> Self
Create a buffer for an enum variant with named fields, like A::B { a: T, b: U }
.
sourcepub fn seq(fields: impl IntoIterator<Item = Ref<'a>>) -> Self
pub fn seq(fields: impl IntoIterator<Item = Ref<'a>>) -> Self
Create a buffer for a sequence.
sourcepub fn map(fields: impl IntoIterator<Item = (Ref<'a>, Ref<'a>)>) -> Self
pub fn map(fields: impl IntoIterator<Item = (Ref<'a>, Ref<'a>)>) -> Self
Create a buffer for a map.