pub enum Ty {
Show 30 variants
Error,
Never,
Base(BaseType),
Named {
name: String,
kind: NamedKind,
args: Vec<TyId>,
},
Result(TyId, TyId),
Option(TyId),
Effect(TyId),
HttpResult(TyId),
QueueResult,
HttpOutcome(TyId),
BoundaryRejection,
Asset,
RequestHeaders,
RequestQuery,
RequestCookies,
TokenClaims,
List(TyId),
Map(TyId, TyId),
Set(TyId),
Query(TyId),
Stream(TyId),
Connection(TyId),
TestConnection(TyId),
ValidationError,
DecodeError,
Unit,
Actor(TyId),
ActorSum(Vec<(String, TyId)>),
Fn {
params: Vec<TyId>,
ret: TyId,
},
Var(String),
}Expand description
A resolved type.
Variants§
Error
R4.3 measurement probe (not shipped): a real Error variant.
Never
#2620 (DECISION A): the bottom type of unreachable(…) / todo(…) —
an expression that never produces a value. Assignable to every type
and absorbed by every join; never nameable in source.
Base(BaseType)
A base type (Int, String, Bool).
Named
A user-declared named type. kind records the declaration’s shape
for compatibility / dispatch decisions. args holds the applied type
arguments of a generic type (Paginated[String] → args = [String]);
it is empty for a non-generic type (v0.157, ADR 0183). Substitution,
unification, and display recurse into args.
Result(TyId, TyId)
Result[T, E].
Option(TyId)
Option[T].
Effect(TyId)
Effect[T] (v0.5).
HttpResult(TyId)
HttpResult[T] (v0.9).
QueueResult
QueueResult — the built-in queue verdict sum (v0.44). Non-generic.
HttpOutcome(TyId)
HttpOutcome[T] — what a system-tier case observes when it drives an
http address past the handler’s types (#1934): a Wire(…) argument, by Nobody, or a method the path declares no handler for. Rejected( BoundaryRejection) when the router or the auth seam refused the request
before the handler ran, Handled(HttpResult[T]) when it ran. Produced
only by a test-service address; it cannot be written in source.
BoundaryRejection
BoundaryRejection — why the boundary refused a request before the
handler (#1934), the payload of HttpOutcome.Rejected. Non-generic.
Asset
Asset — a static file declared by asset name = "path" (#1883,
slice 1a, [DECISION H]). Non-generic; its one field is .url : String.
RequestHeaders
RequestHeaders — an HTTP handler’s read-only view of the request’s
headers (#2341, decision A). Non-generic and opaque, with no wire form.
RequestQuery
RequestQuery (#2854) — an HTTP handler’s read-only view of the
request’s query string.
RequestCookies
RequestCookies (#3277) — an HTTP handler’s read-only view of the
request’s Cookie header.
TokenClaims
TokenClaims (#2380, L5) — an Oidc actor’s verified token claims,
read through its binder’s .claims.
List(TyId)
List[T] — built-in immutable list (v0.20b).
Map(TyId, TyId)
Map[K, V] — built-in immutable map (v0.20b). The key type is
confined to value-keyable types at TypeRef resolution.
Set(TyId)
Set[T] — built-in immutable set (K6a, #2596). The element type is
confined to the Map-key rule at TypeRef resolution.
Query(TyId)
Query[T] — a lazy, by-reference description of a read over agent-local
storage (v0.91, ADR 0115). The inner type is the element a terminal
yields. Built by the lazy combinator vocabulary over a store field,
executed by a terminal (-> Effect[…]). Non-storable, non-boundary, and
not value-comparable — like Effect/Fn (ADRs 0031/0030).
Stream(TyId)
Stream[T] — a lazy, pull-shaped sequence of values produced over time
(v0.100, real-time track slice 0). The inner type is the element a
terminal yields. Built from a runtime source (Stream.of at v1),
transformed by lazy builders (map/take), drained by a terminal
(collect -> Effect[List[T]]). Non-storable, non-boundary, and not
value-comparable — like Query/Effect/Fn (ADRs 0031/0030).
Connection(TyId)
Connection[F] — a held WebSocket connection (v0.102, real-time track
slice 2). F is the server→client frame type. The one concrete instance
of the closed Held kind (is_held). Governed by the linearity
discipline (§2.9): single-owner, mandatory disposal. Non-serialisable,
non-boundary, non-comparable; storable only in Cell[Option[Connection]]
/ Map[K, Connection].
TestConnection(TyId)
TestConnection[F] (#3051) — a case-scoped recording handle for a
from websocket service’s connection. Not held: a case reads what the
server sent (.sent(), .closed()) and mints the owned Connection[F]
an agent receives (.connection()). Suite-only; nameable only by the
TestConnection[F]() constructor call.
ValidationError
ValidationError — built-in error type.
DecodeError
DecodeError — built-in JSON-decode error type (v0.22b). A uniform
record: kind/path/message, all String.
Unit
() — the unit type (v0.5).
Actor(TyId)
v0.45: a verified actor binding (by name: Actor). The inner type is
the actor’s identity, read as name.identity. A boundary-minted, sealed
value — only ever .identity-accessed, never constructed or passed.
ActorSum(Vec<(String, TyId)>)
v0.52: a resolved multi-actor binding (by who: A | B) — an ordered sum
of peer actors. Each member is (actor name, identity ty); the body
matches on the resolved actor, each non-unit member binding its
identity directly. Like Actor, a sealed boundary value — only ever
matched, never constructed or passed.
Fn
A -> B — a function type (v0.20a). Effectful iff ret is
Effect[_] (the structural rule); no separate flag, so there is a
single source of truth.
Var(String)
A function type parameter (v0.20a). Two lives: rigid while checking
a generic function’s own body (name-equality in compatible), and
flexible during call-site instantiation, where it is matched by
unify and fully eliminated by substitute before any compatible
runs against argument types. Vars never escape call checking into the
caller’s expression types.
Implementations§
Source§impl Ty
impl Ty
Sourcepub fn display(&self, types: &Types) -> String
pub fn display(&self, types: &Types) -> String
Display name for diagnostics. Takes the table the type was interned
into (T3.6b): every recursive field is a TyId now, so rendering a
nested type is a table read rather than a pointer chase.
Sourcepub fn is_held(&self) -> bool
pub fn is_held(&self) -> bool
v0.102: true if this type belongs to the closed Held kind — a
runtime-managed resource governed by the linearity discipline (§2.9).
The one instance at v1 is Connection[F]; the single extension point
for future held types (file handles, DB connections).
Sourcepub fn held_inner(&self) -> Option<TyId>
pub fn held_inner(&self) -> Option<TyId>
v0.102: for a Held type, the held element it wraps (the frame type of a
Connection[F]). Used by the storage-admission rules to look through an
Option[Connection] value.
Sourcepub fn base(&self) -> Option<BaseType>
pub fn base(&self) -> Option<BaseType>
The underlying base type, if this type widens to a base type.
Opaque types deliberately do NOT widen — that’s the whole point of
the opacity — so Ty::Named { kind: Opaque(_), .. } returns None.
Sourcepub fn as_option(&self) -> Option<TyId>
pub fn as_option(&self) -> Option<TyId>
The payload T of an Option[T], or None for any other type.
Sourcepub fn as_effect(&self) -> Option<TyId>
pub fn as_effect(&self) -> Option<TyId>
The payload T of an Effect[T], or None for any other type.
Sourcepub fn as_result(&self) -> Option<(TyId, TyId)>
pub fn as_result(&self) -> Option<(TyId, TyId)>
The (T, E) of a Result[T, E], or None for any other type.
Sourcepub fn scalar_base(&self) -> Option<BaseType>
pub fn scalar_base(&self) -> Option<BaseType>
The base type a scalar-shaped type is made of: a base type itself, or a
refined or opaque named type over one. Ty::base is the same question
minus the opaque case, which does not widen.
Trait Implementations§
Source§impl Ord for Ty
impl Ord for Ty
Source§impl PartialOrd for Ty
impl PartialOrd for Ty
impl Eq for Ty
impl StructuralPartialEq for Ty
Auto Trait Implementations§
impl Freeze for Ty
impl RefUnwindSafe for Ty
impl Send for Ty
impl Sync for Ty
impl Unpin for Ty
impl UnsafeUnpin for Ty
impl UnwindSafe for Ty
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);