pub struct Box<T>(_);
Methods
impl<T> Box<T>
fn new(x: T) -> Box<T>
Allocates memory on the heap and then moves x
into it.
let x = Box::new(5);
Unstable: may be renamed or moved out of Box scope
Constructs a box from the raw pointer.
After this function call, pointer is owned by resulting box.
In particular, it means that Box
destructor calls destructor
of T
and releases memory. Since the way Box
allocates and
releases memory is unspecified, the only valid pointer to pass
to this function is the one taken from another Box
with
boxed::into_raw
function.
Function is unsafe, because improper use of this function may
lead to memory problems like double-free, for example if the
function is called twice on the same raw pointer.
Attempt to downcast the box to a concrete type.
Attempt to downcast the box to a concrete type.
Trait Implementations
type Target = T
fn deref(&self) -> &T
type Item = I::Item
fn next(&mut self) -> Option<I::Item>
fn map<B, F>(self, f: F) -> Map<Self, F> where F: FnMut(Self::Item) -> B
fn filter<P>(self, predicate: P) -> Filter<Self, P> where P: FnMut(&Self::Item) -> bool
fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F> where F: FnMut(&mut St, Self::Item) -> Option<B>
fn fuse(self) -> Fuse<Self>
fn inspect<F>(self, f: F) -> Inspect<Self, F> where F: FnMut(&Self::Item) -> ()
fn by_ref(&mut self) -> &mut Self
fn fold<B, F>(self, init: B, f: F) -> B where F: FnMut(B, Self::Item) -> B
fn all<F>(&mut self, f: F) -> bool where F: FnMut(Self::Item) -> bool
fn any<F>(&mut self, f: F) -> bool where F: FnMut(Self::Item) -> bool
fn find<P>(&mut self, predicate: P) -> Option<Self::Item> where P: FnMut(&Self::Item) -> bool
fn max_by<B, F>(self, f: F) -> Option<Self::Item> where B: Ord, F: FnMut(&Self::Item) -> B
fn min_by<B, F>(self, f: F) -> Option<Self::Item> where B: Ord, F: FnMut(&Self::Item) -> B
fn cloned<'a, T>(self) -> Cloned<Self> where Self: Iterator<Item=&'a T>, T: 'a + Clone
fn cycle(self) -> Cycle<Self> where Self: Clone
fn sum<S = Self::Item>(self) -> S where S: Add<Self::Item, Output=S> + Zero
fn product<P = Self::Item>(self) -> P where P: Mul<Self::Item, Output=P> + One
impl<'a, A, R> FnOnce<A> for Box<FnBox<A, Output=R> + 'a>
type Output = R
extern "rust-call" fn call_once(self, args: A) -> R
impl<'a, A, R> FnOnce<A> for Box<FnBox<A, Output=R> + Send + 'a>
type Output = R
extern "rust-call" fn call_once(self, args: A) -> R
Keyboard shortcuts
- ?
- Show this help dialog
- S
- Focus the search field
- ⇤
- Move up in search results
- ⇥
- Move down in search results
- ⏎
- Go to active search result
Search tricks
Prefix searches with a type followed by a colon (e.g.
fn:
) to restrict the search to a given type.
Accepted types are: fn
, mod
,
struct
, enum
,
trait
, typedef
(or
tdef
).
Search functions by type signature (e.g.
vec -> usize
)