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 strThe 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: boolWhether 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
impl BuiltinSchema
Sourcepub fn method(&self, name: &str) -> Option<&'static MethodSchema>
pub fn method(&self, name: &str) -> Option<&'static MethodSchema>
The method name, if this type has one.
Sourcepub fn associated_function(&self, name: &str) -> Option<&'static MethodSchema>
pub fn associated_function(&self, name: &str) -> Option<&'static MethodSchema>
The associated function name, if this type has one.
Sourcepub fn case(&self, name: &str) -> Option<&'static CaseSchema>
pub fn case(&self, name: &str) -> Option<&'static CaseSchema>
The case name, if this type declares one.
Sourcepub fn field(&self, name: &str) -> Option<&'static FieldSchema>
pub fn field(&self, name: &str) -> Option<&'static FieldSchema>
The field name, if this type declares one.
Trait Implementations§
Source§impl Clone for BuiltinSchema
impl Clone for BuiltinSchema
Source§fn clone(&self) -> BuiltinSchema
fn clone(&self) -> BuiltinSchema
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for BuiltinSchema
Source§impl Debug for BuiltinSchema
impl Debug for BuiltinSchema
impl Eq for BuiltinSchema
Source§impl PartialEq for BuiltinSchema
impl PartialEq for BuiltinSchema
Source§fn eq(&self, other: &BuiltinSchema) -> bool
fn eq(&self, other: &BuiltinSchema) -> bool
self and other values to be equal, and is used by ==.