pub enum BuiltinType {
Show 19 variants
Unit,
Bool,
Int,
Float,
String,
Error,
Duration,
Array(&'static BuiltinType),
Vector(&'static BuiltinType),
Set(&'static BuiltinType),
Map(&'static BuiltinType, &'static BuiltinType),
MapEntry(&'static BuiltinType, &'static BuiltinType),
Option(&'static BuiltinType),
Result(&'static BuiltinType, &'static BuiltinType),
Task(&'static BuiltinType),
Shared(&'static BuiltinType),
Fn(&'static [BuiltinType], &'static BuiltinType),
Param(&'static str),
SelfType,
}Expand description
A type in a builtin’s signature, written in Cove’s source vocabulary.
Like HostType this is a small enum rather than
cove_syntax::ast::Type, because a builtin has no source to point a span
at, and like HostType its fmt::Display produces the form the type
would be written in Cove.
Variants§
Unit
Unit, what a method that produces nothing answers.
Bool
Bool.
Int
Int, a signed 64-bit integer.
Float
Float, a 64-bit binary floating-point number.
String
String.
Error
Error, the builtin error struct.
Duration
Duration, a signed count of nanoseconds.
Array(&'static BuiltinType)
Array<T>, the fixed-length immutable sequence.
Vector(&'static BuiltinType)
Vector<T>, the growable one.
Set(&'static BuiltinType)
Set<T>.
Map(&'static BuiltinType, &'static BuiltinType)
Map<K, V>.
MapEntry(&'static BuiltinType, &'static BuiltinType)
MapEntry<K, V>, the one key/value pair Map.of collects.
Option(&'static BuiltinType)
Option<T>.
Result(&'static BuiltinType, &'static BuiltinType)
Result<T, E>.
Task(&'static BuiltinType)
Task<T>, the handle scope.spawn { ... } hands back.
Shared<T>, the synchronized value Shared(...) wraps one in.
Fn(&'static [BuiltinType], &'static BuiltinType)
fn(A, B) -> R: what a builtin that takes a callback declares, such
as Shared<T>.lock or Scope.spawn.
Param(&'static str)
A type parameter, by name.
It is bound either by the receiver — the T of the Array<T> a
method was called on — or by the signature itself, as
Vector.of(items: T...) binds one. Which of the two a name is comes
from where it is declared: BuiltinSchema::parameters for the
receiver’s, MethodSchema::generics for the signature’s.
SelfType
The receiver’s own type, written Self.
This is what snapshot answers, and it is one of the reasons a
builtin’s signature cannot be written in the host vocabulary: an
immutable builtin snapshots to itself, so its result is not a type at
all until there is a receiver to read it off.
Trait Implementations§
Source§impl Clone for BuiltinType
impl Clone for BuiltinType
Source§fn clone(&self) -> BuiltinType
fn clone(&self) -> BuiltinType
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 BuiltinType
Source§impl Debug for BuiltinType
impl Debug for BuiltinType
Source§impl Display for BuiltinType
impl Display for BuiltinType
impl Eq for BuiltinType
Source§impl PartialEq for BuiltinType
impl PartialEq for BuiltinType
Source§fn eq(&self, other: &BuiltinType) -> bool
fn eq(&self, other: &BuiltinType) -> bool
self and other values to be equal, and is used by ==.