Skip to main content

FreeBuiltinSchema

Struct FreeBuiltinSchema 

Source
pub struct FreeBuiltinSchema {
    pub name: &'static str,
    pub kind: FreeBuiltinKind,
    pub generics: &'static [&'static str],
    pub params: &'static [ParamSchema],
    pub result: BuiltinType,
}
Expand description

One builtin that is called on nothing.

A BuiltinSchema is keyed by a receiver, and these have none: Ok(1) and assert(true) are written bare, like a declared function and unlike items.length() or Vector.of(1). Straining the receiver-keyed table to hold them would have meant inventing a receiver they do not have, so they have a table of their own, and it is close to the plainest thing that lets both ends stop restating each other: a name, which kind it is, and the parameters it takes.

The result is here too, because the checker reads it in both directions. A constructor’s result is generic — Ok(value: T) -> Result<T, E> — and the type a call site expects is what settles T and E, so the one declaration that says what Ok produces is also the one that says what its payload must be. That is why this carries a signature rather than only an arity: the arity is what the runtime needs, and the signature is what stops the checker from writing the same five names out again to say what each of them makes.

Fields§

§name: &'static str

The name Cove source calls, such as Ok.

§kind: FreeBuiltinKind

Whether this builds a value or checks one.

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

The type parameters this signature binds.

Every type parameter a free builtin names is one it binds itself: there is no receiver to read one off. A call site settles them from the type it expects, and from the arguments where it expects nothing in particular.

§params: &'static [ParamSchema]

Parameters in declaration order, labelled as a diagnostic names them.

§result: BuiltinType

The type the call produces.

Implementations§

Source§

impl FreeBuiltinSchema

Source

pub fn arity(&self) -> usize

How many arguments a call must supply.

Source

pub fn signature(&self) -> String

The signature, in the form it would be written in Cove source: assertEqual(actual: T, expected: T) -> Result<Unit, Error>.

Trait Implementations§

Source§

impl Clone for FreeBuiltinSchema

Source§

fn clone(&self) -> FreeBuiltinSchema

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 FreeBuiltinSchema

Source§

impl Debug for FreeBuiltinSchema

Source§

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

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

impl Eq for FreeBuiltinSchema

Source§

impl PartialEq for FreeBuiltinSchema

Source§

fn eq(&self, other: &FreeBuiltinSchema) -> 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 FreeBuiltinSchema

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.