Skip to main content

Definition

Struct Definition 

Source
pub struct Definition {
    pub visibility: Visibility,
    pub ty: TypeScheme,
    pub name_span: Option<Span>,
    pub doc: Option<String>,
    pub body: DefinitionBody,
}

Fields§

§visibility: Visibility§ty: TypeScheme§name_span: Option<Span>§doc: Option<String>§body: DefinitionBody

Implementations§

Source§

impl Definition

Source

pub fn is_newtype(&self) -> bool

A newtype is a single-field, non-generic tuple struct. Relevant because Go compiles newtypes to named scalar types, so .0 is a cast rather than a field access, it cannot be assigned to, and taking its address is invalid.

Source

pub fn newtype_field(&self) -> Option<&Type>

Source

pub fn is_pointer_backed_newtype(&self) -> bool

Source

pub fn alias_target(&self) -> Option<&Type>

Source

pub fn instantiate_alias_target( &self, params: &[Type], writable: bool, ) -> Option<Type>

Source

pub fn newtype_underlying(&self, writable: bool) -> Option<Type>

Source

pub fn constructor_type(&self) -> Option<TypeScheme>

Returns the callable type of a tuple struct constructor.

The constructor is derived from the struct’s resolved fields and type rather than stored separately, so it cannot become stale when either source changes.

Source

pub fn allowed_lints(&self) -> &[String]

Source

pub fn go_hints(&self) -> &[GoHint]

Source

pub fn go_name(&self) -> Option<&str>

Source

pub fn go_type_param_recipe(&self) -> Option<&[GoTypeRecipe]>

Source

pub fn go_type_terms(&self) -> &[GoTypeTerms]

Source

pub fn impl_receiver(&self) -> Option<&Type>

Source

pub fn superseded_by(&self) -> Option<&str>

Source

pub fn const_value(&self) -> Option<&ConstantValue>

Source

pub fn is_const(&self) -> bool

Source

pub fn is_read_only(&self) -> bool

A Go var that the bindings type wider than Go, so Go rejects writes and &.

Source

pub fn is_variable(&self) -> bool

Source

pub fn methods_mut(&mut self) -> Option<&mut Methods>

Source

pub fn methods(&self) -> Option<&Methods>

Source

pub fn fields(&self) -> Option<&[StructFieldDefinition]>

Source

pub fn is_interface(&self) -> bool

Source

pub fn is_ufcs_method(&self, method: &str) -> bool

Source

pub fn is_display(&self) -> bool

Source

pub fn is_zero_safe(&self) -> bool

Source

pub fn is_zero_unsafe(&self) -> bool

Source

pub fn has_hidden_fields(&self) -> bool

Source

pub fn is_closed_domain(&self) -> bool

Source

pub fn is_serialized(&self) -> bool

Source

pub fn is_anon_struct(&self) -> bool

Source

pub fn has_hidden_embed(&self) -> bool

Source

pub fn is_incomparable(&self) -> bool

Source

pub fn requires_comparable_argument(&self, position: usize) -> bool

Source

pub fn is_constraint(&self) -> bool

Source

pub fn is_type_definition(&self) -> bool

Source

pub fn is_type_alias(&self) -> bool

Source

pub fn is_value(&self, qualified_name: &str) -> bool

Trait Implementations§

Source§

impl Clone for Definition

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Definition

Source§

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

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

impl PartialEq for Definition

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Definition

Auto Trait Implementations§

§

impl Forget for Definition

§

impl Freeze for Definition

§

impl Move for Definition

§

impl RefUnwindSafe for Definition

§

impl Send for Definition
where RawVecInner: Send, EcoVec<u8>: Send, Arc<Box<[Type]>>: Send, Arc<FunctionType>: Send, BoxRaw<Type>: Send, Arc<Spelling>: Send, BoxRaw<Annotation>: Send, Arc<HashMap<EcoString, Method, FxBuildHasher>>: Send, RawTable<(EcoString, usize)>: Send, BoxRaw<GoTypeRecipe>: Send,

§

impl Sync for Definition
where RawVecInner: Sync, EcoVec<u8>: Sync, Arc<Box<[Type]>>: Sync, Arc<FunctionType>: Sync, BoxRaw<Type>: Sync, Arc<Spelling>: Sync, BoxRaw<Annotation>: Sync, Arc<HashMap<EcoString, Method, FxBuildHasher>>: Sync, RawTable<(EcoString, usize)>: Sync, BoxRaw<GoTypeRecipe>: Sync,

§

impl Unpin for Definition

§

impl UnsafeUnpin for Definition

§

impl UnwindSafe for Definition

Blanket Implementations§

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, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.