pub type ProvidedValue<'tcx> = Visibility<DefId>;
Expand description

This type alias specifies the type returned from query providers and the type used for decoding. For regular queries this is the declared returned type V, but arena_cache will use <V as Deref>::Target instead.

Aliased Type§

enum ProvidedValue<'tcx> {
    Public,
    Restricted(DefId),
}

Variants§

§

Public

Visible everywhere (including in other crates).

§

Restricted(DefId)

Visible only in the given crate-local module.

Implementations§

source§

impl<Id> Visibility<Id>

source

pub fn is_public(self) -> bool

source

pub fn map_id<OutId>(self, f: impl FnOnce(Id) -> OutId) -> Visibility<OutId>

source§

impl<Id: Into<DefId>> Visibility<Id>

source

pub fn to_def_id(self) -> Visibility<DefId>

source

pub fn is_accessible_from( self, module: impl Into<DefId>, tcx: TyCtxt<'_> ) -> bool

Returns true if an item with this visibility is accessible from the given module.

source

pub fn is_at_least( self, vis: Visibility<impl Into<DefId>>, tcx: TyCtxt<'_> ) -> bool

Returns true if this visibility is at least as accessible as the given visibility

source§

impl Visibility<DefId>

source

pub fn expect_local(self) -> Visibility

source

pub fn is_visible_locally(self) -> bool

Returns true if this item is visible anywhere in the local crate.

Trait Implementations§

source§

impl<Id: Clone> Clone for Visibility<Id>

source§

fn clone(&self) -> Visibility<Id>

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<Id: Debug> Debug for Visibility<Id>

source§

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

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

impl<Id, __D: Decoder> Decodable<__D> for Visibility<Id>where Id: Decodable<__D>,

source§

fn decode(__decoder: &mut __D) -> Self

source§

impl<Id, __E: Encoder> Encodable<__E> for Visibility<Id>where Id: Encodable<__E>,

source§

fn encode(&self, __encoder: &mut __E)

source§

impl EraseType for Visibility<DefId>

§

type Result = [u8; 8]

source§

impl<Id: Hash> Hash for Visibility<Id>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<'__ctx, Id> HashStable<StableHashingContext<'__ctx>> for Visibility<Id>where Id: HashStable<StableHashingContext<'__ctx>>,

source§

fn hash_stable( &self, __hcx: &mut StableHashingContext<'__ctx>, __hasher: &mut StableHasher )

source§

impl<Id: PartialEq> PartialEq<Visibility<Id>> for Visibility<Id>

source§

fn eq(&self, other: &Visibility<Id>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<Id: Copy> Copy for Visibility<Id>

source§

impl<Id: Eq> Eq for Visibility<Id>

source§

impl<Id> StructuralEq for Visibility<Id>

source§

impl<Id> StructuralPartialEq for Visibility<Id>

Layout§

Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.

Size: 8 bytes

Size for each variant:

  • Public: 0 bytes
  • Restricted: 8 bytes