pub trait Poppable: TupleLike {
type PopFrontOutput: TupleLike;
type PopFrontElement;
type PopBackOutput: TupleLike;
type PopBackElement;
// Required methods
fn pop(self) -> (Self::PopBackOutput, Self::PopBackElement);
fn pop_front(self) -> (Self::PopFrontOutput, Self::PopFrontElement);
// Provided method
fn pop_back(self) -> (Self::PopBackOutput, Self::PopBackElement)
where Self: Sized { ... }
}
Expand description
Required Associated Types§
Sourcetype PopFrontOutput: TupleLike
type PopFrontOutput: TupleLike
The type of tuple generated by popping an element from the front of the tuple.
Sourcetype PopFrontElement
type PopFrontElement
The type of the element popped from the front of the tuple.
Sourcetype PopBackOutput: TupleLike
type PopBackOutput: TupleLike
The type of tuple generated by popping an element from the back of the tuple.
Sourcetype PopBackElement
type PopBackElement
The type of the element popped from the back of the tuple.
Required Methods§
Sourcefn pop(self) -> (Self::PopBackOutput, Self::PopBackElement)
fn pop(self) -> (Self::PopBackOutput, Self::PopBackElement)
Pop an element from the back of the tuple.
Hint: The TupleLike
trait provides the pop()
method as the wrapper
for this pop()
method.
§Examples
use tuplez::{tuple, TupleLike};
let tup = tuple!(1, "hello", 3.14);
let (tup2, popped) = tup.pop();
assert_eq!(tup2, tuple!(1, "hello"));
assert_eq!(popped, 3.14);
Sourcefn pop_front(self) -> (Self::PopFrontOutput, Self::PopFrontElement)
fn pop_front(self) -> (Self::PopFrontOutput, Self::PopFrontElement)
Pop an element from the front of the tuple.
Hint: The TupleLike
trait provides the pop_front()
method as the wrapper
for this pop_front()
method.
§Examples
use tuplez::{tuple, TupleLike};
let tup = tuple!(1, "hello", 3.14);
let (tup2, popped) = tup.pop_front();
assert_eq!(tup2, tuple!("hello", 3.14));
assert_eq!(popped, 1);
Provided Methods§
Sourcefn pop_back(self) -> (Self::PopBackOutput, Self::PopBackElement)where
Self: Sized,
fn pop_back(self) -> (Self::PopBackOutput, Self::PopBackElement)where
Self: Sized,
Pop an element from the back of the tuple. Same as pop()
.
Hint: The TupleLike
trait provides the pop_back()
method as the wrapper
for this pop_back()
method.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.