pub struct Tup3<A, B, C>(pub FieldMarker<A>, pub FieldMarker<B>, pub FieldMarker<C>);
Expand description
Tuple of variable-length types.
Examples
use varlen::prelude::*;
use varlen::Layout;
let mut t: VBox<Tup3<Str, Str, Str>> = VBox::new(tup3::Init(
Str::copy("hello"),
Str::copy("brave"),
Str::copy("world"),
));
assert_eq!(&t.refs().0[..], "hello");
assert_eq!(&t.refs().1[..], "brave");
assert_eq!(&t.refs().2[..], "world");
t.as_mut().muts().0.mut_slice().make_ascii_uppercase();
assert_eq!(&t.refs().0[..], "HELLO");
assert_eq!(&t.refs().1[..], "brave");
assert_eq!(&t.refs().2[..], "world");
assert_eq!(t.calculate_layout().size(),
core::mem::size_of::<usize>() * 3 + 8 /* hello */ + 8 /* brave */ + 5 /* world */);
Tuple Fields
0: FieldMarker<A>
1: FieldMarker<B>
2: FieldMarker<C>
Implementations
sourceimpl<A: VarLen, B: VarLen, C: VarLen> Tup3<A, B, C>
impl<A: VarLen, B: VarLen, C: VarLen> Tup3<A, B, C>
sourcepub fn refs(&self) -> Refs<'_, A, B, C>
pub fn refs(&self) -> Refs<'_, A, B, C>
Immutable access to fields of a tuple.
Examples
use varlen::prelude::*;
use varlen::Layout;
let mut t: VBox<Tup3<Str, Str, Str>> = VBox::new(tup3::Init(
Str::copy("hello"),
Str::copy("brave"),
Str::copy("world"),
));
assert_eq!(&t.refs().0[..], "hello");
assert_eq!(&t.refs().1[..], "brave");
assert_eq!(&t.refs().2[..], "world");
t.as_mut().muts().0.mut_slice().make_ascii_uppercase();
assert_eq!(&t.refs().0[..], "HELLO");
assert_eq!(&t.refs().1[..], "brave");
assert_eq!(&t.refs().2[..], "world");
assert_eq!(t.calculate_layout().size(),
core::mem::size_of::<usize>() * 3 + 8 /* hello */ + 8 /* brave */ + 5 /* world */);
sourcepub fn muts(self: Pin<&mut Self>) -> Muts<'_, A, B, C>
pub fn muts(self: Pin<&mut Self>) -> Muts<'_, A, B, C>
Mutable access to fields of a tuple.
Examples
use varlen::prelude::*;
use varlen::Layout;
let mut t: VBox<Tup3<Str, Str, Str>> = VBox::new(tup3::Init(
Str::copy("hello"),
Str::copy("brave"),
Str::copy("world"),
));
assert_eq!(&t.refs().0[..], "hello");
assert_eq!(&t.refs().1[..], "brave");
assert_eq!(&t.refs().2[..], "world");
t.as_mut().muts().0.mut_slice().make_ascii_uppercase();
assert_eq!(&t.refs().0[..], "HELLO");
assert_eq!(&t.refs().1[..], "brave");
assert_eq!(&t.refs().2[..], "world");
assert_eq!(t.calculate_layout().size(),
core::mem::size_of::<usize>() * 3 + 8 /* hello */ + 8 /* brave */ + 5 /* world */);
Trait Implementations
sourceimpl<'a, A: VClone<'a>, B: VClone<'a>, C: VClone<'a>> Initializer<Tup3<A, B, C>> for Cloner<'a, A, B, C>
impl<'a, A: VClone<'a>, B: VClone<'a>, C: VClone<'a>> Initializer<Tup3<A, B, C>> for Cloner<'a, A, B, C>
sourceimpl<A: VarLen, AInit: Initializer<A>, B: VarLen, BInit: Initializer<B>, C: VarLen, CInit: Initializer<C>> Initializer<Tup3<A, B, C>> for Init<AInit, BInit, CInit>
impl<A: VarLen, AInit: Initializer<A>, B: VarLen, BInit: Initializer<B>, C: VarLen, CInit: Initializer<C>> Initializer<Tup3<A, B, C>> for Init<AInit, BInit, CInit>
sourcefn calculate_layout_cautious(&self) -> Option<Layout<A, B, C>>
fn calculate_layout_cautious(&self) -> Option<Layout<A, B, C>>
Calculates the layout of the object, returning None
if any of the calculated sizes
or offsets would overflow usize
. Read more
sourceimpl<A: VarLen, B: VarLen, C: VarLen> VarLen for Tup3<A, B, C>
impl<A: VarLen, B: VarLen, C: VarLen> VarLen for Tup3<A, B, C>
type Layout = Layout<A, B, C>
type Layout = Layout<A, B, C>
This type’s internal dynamic calculations of where its tail fields are. Read more
sourceconst NEEDS_VDROP: bool
const NEEDS_VDROP: bool
sourcefn calculate_layout(&self) -> Layout<A, B, C>
fn calculate_layout(&self) -> Layout<A, B, C>
Calculates the layout of the internal fields of this object. Read more
Auto Trait Implementations
impl<A, B, C> RefUnwindSafe for Tup3<A, B, C> where
A: RefUnwindSafe,
B: RefUnwindSafe,
C: RefUnwindSafe,
impl<A, B, C> Send for Tup3<A, B, C> where
A: Send,
B: Send,
C: Send,
impl<A, B, C> Sync for Tup3<A, B, C> where
A: Sync,
B: Sync,
C: Sync,
impl<A, B, C> !Unpin for Tup3<A, B, C>
impl<A, B, C> UnwindSafe for Tup3<A, B, C> where
A: UnwindSafe,
B: UnwindSafe,
C: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more