rustc_ast::ptr

Struct P

source
pub struct P<T: ?Sized> {
    ptr: Box<T>,
}
Expand description

An owned smart pointer.

See the module level documentation for details.

Fields§

§ptr: Box<T>

Implementations§

source§

impl<T: 'static> P<T>

source

pub fn and_then<U, F>(self, f: F) -> U
where F: FnOnce(T) -> U,

Move out of the pointer. Intended for chaining transformations not covered by map.

source

pub fn into_inner(self) -> T

Equivalent to and_then(|x| x).

source

pub fn map<F>(self, f: F) -> P<T>
where F: FnOnce(T) -> T,

Produce a new P<T> from self without reallocating.

source

pub fn filter_map<F>(self, f: F) -> Option<P<T>>
where F: FnOnce(T) -> Option<T>,

Optionally produce a new P<T> from self without reallocating.

source§

impl<T> P<[T]>

source

pub fn new() -> P<[T]>

source

pub fn from_vec(v: Vec<T>) -> P<[T]>

source

pub fn into_vec(self) -> Vec<T>

Trait Implementations§

source§

impl<T> AstDeref for P<T>

source§

type Target = T

source§

fn ast_deref(&self) -> &Self::Target

source§

fn ast_deref_mut(&mut self) -> &mut Self::Target

source§

impl<T: Clone> Clone for P<[T]>

source§

fn clone(&self) -> P<[T]>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: 'static + Clone> Clone for P<T>

source§

fn clone(&self) -> P<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T: ?Sized + Debug> Debug for P<T>

source§

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

Formats the value using the given formatter. Read more
source§

impl<D: Decoder, T: Decodable<D>> Decodable<D> for P<[T]>

source§

impl<D: Decoder, T: 'static + Decodable<D>> Decodable<D> for P<T>

source§

fn decode(d: &mut D) -> P<T>

source§

impl<T> Default for P<[T]>

source§

fn default() -> P<[T]>

Creates an empty P<[T]>.

source§

impl<T: ?Sized> Deref for P<T>

source§

type Target = T

The resulting type after dereferencing.
source§

fn deref(&self) -> &T

Dereferences the value.
source§

impl<T: ?Sized> DerefMut for P<T>

source§

fn deref_mut(&mut self) -> &mut T

Mutably dereferences the value.
source§

impl<T: Display> Display for P<T>

source§

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

Formats the value using the given formatter. Read more
source§

impl<T: DummyAstNode + 'static> DummyAstNode for P<T>

source§

fn dummy() -> Self

source§

impl<S: Encoder, T: Encodable<S>> Encodable<S> for P<[T]>

source§

fn encode(&self, s: &mut S)

source§

impl<S: Encoder, T: Encodable<S>> Encodable<S> for P<T>

source§

fn encode(&self, s: &mut S)

source§

impl From<P<Ty>> for Term

source§

fn from(v: P<Ty>) -> Self

Converts to this type from the input type.
source§

impl<T> From<Vec<T>> for P<[T]>

source§

fn from(v: Vec<T>) -> Self

Converts to this type from the input type.
source§

impl<T> FromIterator<T> for P<[T]>

source§

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> P<[T]>

Creates a value from an iterator. Read more
source§

impl<CTX, T> HashStable<CTX> for P<T>
where T: ?Sized + HashStable<CTX>,

source§

fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher)

source§

impl Into<P<GenericArgs>> for AngleBracketedArgs

source§

fn into(self) -> P<GenericArgs>

Converts this type into the (usually inferred) input type.
source§

impl Into<P<GenericArgs>> for ParenthesizedArgs

source§

fn into(self) -> P<GenericArgs>

Converts this type into the (usually inferred) input type.
source§

impl<T> Into<Vec<T>> for P<[T]>

source§

fn into(self) -> Vec<T>

Converts this type into the (usually inferred) input type.
source§

impl<'a, T> IntoIterator for &'a P<[T]>

source§

type Item = &'a T

The type of the elements being iterated over.
source§

type IntoIter = Iter<'a, T>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<T> IntoIterator for P<[T]>

source§

type Item = T

The type of the elements being iterated over.
source§

type IntoIter = IntoIter<T>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<T> Pointer for P<T>

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for P<T>
where T: ?Sized,

§

impl<T> RefUnwindSafe for P<T>
where T: RefUnwindSafe + ?Sized,

§

impl<T> Send for P<T>
where T: Send + ?Sized,

§

impl<T> Sync for P<T>
where T: Sync + ?Sized,

§

impl<T> Unpin for P<T>
where T: ?Sized,

§

impl<T> UnwindSafe for P<T>
where T: UnwindSafe + ?Sized,

Blanket Implementations§

source§

impl<T> Aligned for T

source§

const ALIGN: Alignment = _

Alignment of Self.
source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> HasAttrs for T
where T: AstDeref, <T as AstDeref>::Target: HasAttrs,

source§

const SUPPORTS_CUSTOM_INNER_ATTRS: bool = const SUPPORTS_CUSTOM_INNER_ATTRS: bool = <T::Target>::SUPPORTS_CUSTOM_INNER_ATTRS;

This is true if this HasAttrs might support ‘custom’ (proc-macro) inner attributes. Attributes like #![cfg] and #![cfg_attr] are not considered ‘custom’ attributes. Read more
source§

fn attrs(&self) -> &[Attribute]

source§

fn visit_attrs(&mut self, f: impl FnOnce(&mut ThinVec<Attribute>))

source§

impl<T> HasNodeId for T
where T: AstDeref, <T as AstDeref>::Target: HasNodeId,

source§

fn node_id(&self) -> NodeId

source§

fn node_id_mut(&mut self) -> &mut NodeId

source§

impl<T> HasTokens for T
where T: AstDeref, <T as AstDeref>::Target: HasTokens,

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> Same for T

source§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<'a, T> Captures<'a> for T
where T: ?Sized,

Layout§

Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.