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> DynSend for P<T>
where T: DynSend + ?Sized,

§

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

§

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> Pointable for T

Source§

const ALIGN: usize = _

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
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.