Struct WithPart

struct WithPart<T: ?Sized> { ... }

A Writeable that writes out the given part.

Examples

use writeable::adapters::WithPart;
use writeable::assert_writeable_parts_eq;
use writeable::Part;

// Simple usage:

const PART: Part = Part {
    category: "foo",
    value: "bar",
};

assert_writeable_parts_eq!(
    WithPart {
        writeable: "Hello World",
        part: PART
    },
    "Hello World",
    [(0, 11, PART)],
);

// Can be nested:

const PART2: Part = Part {
    category: "foo2",
    value: "bar2",
};

assert_writeable_parts_eq!(
    WithPart {
        writeable: WithPart {
            writeable: "Hello World",
            part: PART
        },
        part: PART2
    },
    "Hello World",
    [(0, 11, PART), (0, 11, PART2)],
);

Fields

part: Part
writeable: T

Implementations

impl<T> Any for WithPart<T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for WithPart<T>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for WithPart<T>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> Freeze for WithPart<T>

impl<T> From for WithPart<T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> RefUnwindSafe for WithPart<T>

impl<T> Send for WithPart<T>

impl<T> Sync for WithPart<T>

impl<T> ToString for WithPart<T>

fn to_string(self: &Self) -> String

impl<T> Unpin for WithPart<T>

impl<T> UnsafeUnpin for WithPart<T>

impl<T> UnwindSafe for WithPart<T>

impl<T, U> Into for WithPart<T>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for WithPart<T>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for WithPart<T>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>

impl<T: $crate::fmt::Debug + ?Sized> Debug for WithPart<T>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<T: Writeable + ?Sized> Display for WithPart<T>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<T: Writeable + ?Sized> Writeable for WithPart<T>

fn write_to<W: fmt::Write + ?Sized>(self: &Self, sink: &mut W) -> Result
fn write_to_parts<W: PartsWrite + ?Sized>(self: &Self, sink: &mut W) -> Result
fn writeable_length_hint(self: &Self) -> LengthHint
fn write_to_string(self: &Self) -> Cow<'_, str>