pub struct BorrowedCow;Expand description
A proxy type that enables borrowing from the document when parsing Cow<'doc, T>.
Unlike the default Cow<'static, T> implementation which always returns Cow::Owned,
this proxy returns Cow::Borrowed by parsing &'doc T directly from the document.
§Example
ⓘ
use eure_macros::FromEure;
use std::borrow::Cow;
#[derive(FromEure)]
struct Data<'doc> {
#[eure(via = "eure_document::proxy::BorrowedCow")]
name: Cow<'doc, str>,
}Trait Implementations§
Source§impl<'doc, T> FromEure<'doc, Cow<'doc, T>> for BorrowedCow
impl<'doc, T> FromEure<'doc, Cow<'doc, T>> for BorrowedCow
Source§impl<'a, T> IntoEure<Cow<'a, T>> for BorrowedCow
impl<'a, T> IntoEure<Cow<'a, T>> for BorrowedCow
Source§type Error = <<T as ToOwned>::Owned as IntoEure>::Error
type Error = <<T as ToOwned>::Owned as IntoEure>::Error
The error type returned when writing. Read more
Source§fn write(
value: Cow<'a, T>,
c: &mut DocumentConstructor,
) -> Result<(), Self::Error>
fn write( value: Cow<'a, T>, c: &mut DocumentConstructor, ) -> Result<(), Self::Error>
Write a value to the current node in the document constructor.
Source§fn write_flatten(
value: T,
rec: &mut RecordWriter<'_>,
) -> Result<(), Self::Error>
fn write_flatten( value: T, rec: &mut RecordWriter<'_>, ) -> Result<(), Self::Error>
Write a value as flattened record fields. Read more
Auto Trait Implementations§
impl Freeze for BorrowedCow
impl RefUnwindSafe for BorrowedCow
impl Send for BorrowedCow
impl Sync for BorrowedCow
impl Unpin for BorrowedCow
impl UnsafeUnpin for BorrowedCow
impl UnwindSafe for BorrowedCow
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