Skip to main content

BuiltinSchema

Struct BuiltinSchema 

Source
pub struct BuiltinSchema {
    pub name: &'static str,
    pub parameters: &'static [&'static str],
    pub namespace: bool,
    pub cases: &'static [CaseSchema],
    pub fields: &'static [FieldSchema],
    pub methods: &'static [MethodSchema],
    pub associated: &'static [MethodSchema],
}
Expand description

One builtin type: its name, its type parameters, and what may be called on a value of it or on the name of it.

Fields§

§name: &'static str

The name Cove source writes, such as Array.

§parameters: &'static [&'static str]

The type parameters the receiver binds, in the order they are written: ["K", "V"] for Map<K, V>.

A method’s signature names these, and a call site reads them off the receiver the method was called on.

§namespace: bool

Whether the name may be written as a namespace, as in Vector.of(...) or Int.parse(...).

This is not the same question as whether the type has associated functions. Array.something() is a call on the builtin type Array whatever something turns out to be, and answering “Array has no associated function something” is better than treating Array as an undeclared name. The types that say false are the ones no program writes the name of: a Task comes from scope.spawn, a Shared from the Shared(...) constructor, a Scope from scope name { ... }, and a Range or a Unit from an expression that makes one. Duration used to be in that list and is not any more — a duration built from a number a program computed is written Duration.millis(n), so the name is one a program writes.

§cases: &'static [CaseSchema]

The cases, for a builtin enum. Empty for everything else.

Option and Result are the two, and this is the one list of what they are made of: match exhaustiveness, the sentence that names a missing case, the type a pattern’s binding gets, and the value the interpreter builds all read it here.

§fields: &'static [FieldSchema]

The fields, for a builtin struct. Empty for everything else.

Error and MapEntry are the two. The order is the order an initializer takes them in and a diagnostic reads them out.

§methods: &'static [MethodSchema]

What may be called on a value of this type.

The order is the order a diagnostic lists them in when it has to say what does exist.

§associated: &'static [MethodSchema]

What may be called on the type itself.

Implementations§

Source§

impl BuiltinSchema

Source

pub fn method(&self, name: &str) -> Option<&'static MethodSchema>

The method name, if this type has one.

Source

pub fn associated_function(&self, name: &str) -> Option<&'static MethodSchema>

The associated function name, if this type has one.

Source

pub fn case(&self, name: &str) -> Option<&'static CaseSchema>

The case name, if this type declares one.

Source

pub fn field(&self, name: &str) -> Option<&'static FieldSchema>

The field name, if this type declares one.

Source

pub fn is_enum(&self) -> bool

Whether this is a builtin enum, which is what having cases means.

Source

pub fn is_struct(&self) -> bool

Whether this is a builtin struct, which is what having fields means.

Trait Implementations§

Source§

impl Clone for BuiltinSchema

Source§

fn clone(&self) -> BuiltinSchema

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 Copy for BuiltinSchema

Source§

impl Debug for BuiltinSchema

Source§

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

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

impl Eq for BuiltinSchema

Source§

impl PartialEq for BuiltinSchema

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for BuiltinSchema

Auto Trait Implementations§

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 = 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.