Skip to main content

Context

Struct Context 

Source
pub struct Context {
Show 17 fields pub typing_context: VarType, pub subtypes: Graph<Type>, pub type_constructors: Vec<(String, Vec<Type>, ConstructorCategory)>, pub interface_constraints: HashMap<String, Type>, pub rigid_counter: u64, pub record_aliases: Vec<(String, Type)>, pub embedded_methods: Vec<(String, String, String)>, pub test_preamble: Vec<String>, pub self_type: Option<Type>, pub expected_return_type: Option<Type>, pub module_inner_contexts: HashMap<String, Arc<Context>>, pub processed_modules: HashMap<String, Type>, pub modules_in_progress: HashSet<String>, pub extern_fns: Vec<(String, Option<String>)>, pub import_from_fns: Vec<(String, String)>, pub signature_fns: Vec<String>, pub vectorizable_fns: Vec<(String, bool)>, /* private fields */
}

Fields§

§typing_context: VarType§subtypes: Graph<Type>§type_constructors: Vec<(String, Vec<Type>, ConstructorCategory)>

Registry of user-declared typeconstructors: (name, parameter signature, category).

§interface_constraints: HashMap<String, Type>

Constraints mapping a rigid generic variable name to its interface. Introduced when an interface type appears in parameter position: fn(i: I): R ⇒ i : A with A: I stored here.

§rigid_counter: u64

Counter for generating unique rigid generic variable names.

§record_aliases: Vec<(String, Type)>

Flat, whole-program registry of every type X <- list { ... } record alias declared anywhere, including inside mod bodies. Unlike typing_context.aliases, this is never scoped away at a module boundary: R’s S3 class system has no module privacy, so transpilation needs the full picture to compute structural supertypes for the class vector (see record_field_class callers in processes::transpiling).

§embedded_methods: Vec<(String, String, String)>

Named type embedding (embed field: Type): provenance of every function auto-generated by forwarding/reconstruction, as (type_name, method_name, source_field_name). Used to detect a later explicit definition that collides with an inherited embedded function (E-EMBED-003).

§test_preamble: Vec<String>

RFC-TR-031: lines injected at the top of a Test { ... } file so the test body can reach @testable private members of the enclosing module (e.g. sq <- Math$.test_sq). Set while transpiling a module body in a test build; empty otherwise. Not serialised.

§self_type: Option<Type>

Self:{ ... } (generic_constructor.md): the type bound to the enclosing function/method’s first parameter, set only while type-checking that function’s body. None everywhere else, which is what makes Self invalid outside a function body.

§expected_return_type: Option<Type>

The declared return type of the function whose body is currently being type-checked (audit_type_checking.md C1) — lets Lang::Return compare an early return against the same target the trailing expression is checked against in function(). None outside a function body.

§module_inner_contexts: HashMap<String, Arc<Context>>

Inner typing contexts computed while type-checking each module M { ... } body, keyed by module name. Populated during type-checking; consumed during transpilation to avoid re-running typing() on every module body.

§processed_modules: HashMap<String, Type>

Cache of fully type-checked modules. Maps module name → its Type::Module so that use Module::*; can be resolved without re-walking the module path in the variable table. Populated by eval() for Lang::Module and consumed by typing() for Lang::UseModule.

§modules_in_progress: HashSet<String>

Set of module names whose body is currently being type-checked. Used to detect circular import chains at the type-checking level. A Lang::UseModule targeting a name in this set is a cycle error.

§extern_fns: Vec<(String, Option<String>)>

Registry of @extern function declarations: (TypR name, R-side qualified name). When Option<String> is None the TypR name is used directly as the R call.

§import_from_fns: Vec<(String, String)>

Registry of @importFrom declarations: (TypR function name, “pkg::fn_name”). At call sites the transpiler emits pkg::fn_name(args) instead of fn_name(args), bypassing TypR’s own S3 generic stubs for names like get, map, factor.

§signature_fns: Vec<String>

Names declared signature-only (@name: T;), i.e. typed here but implemented in R somewhere else — base R, a package, or hand-written R. Unlike an ordinary let, such a name has no TypR body to transpile into name.<Type> methods, so shadowing it with a UseMethod stub strands whatever R implementation it was declared for. typr build reads this to tell the two cases apart when deciding whether a missing <name>.default is worth reporting (see r_name_lint).

§vectorizable_fns: Vec<(String, bool)>

Static vectorizability of user-declared functions, keyed by name: true means every declaration seen so far for that name has a body made only of natively-vectorized R operations (see processes::type_checking::vectorizability), so a Vec[N, T] call site may call it directly instead of wrapping it in vapply. Any non-vectorizable overload of the same name downgrades the entry to false for good (S3 dispatch at the call site can’t tell overloads apart by name alone).

Implementations§

Source§

impl Context

Source

pub fn fingerprint(&self) -> u64

Order-stable hash of everything in the context that can influence how a subsequent expression is typed or transpiled.

Source§

impl Context

Source

pub fn new(types: Vec<(Var, Type)>) -> Context

Source

pub fn empty() -> Self

Source

pub fn is_extern_fn(&self, name: &str) -> bool

Source

pub fn is_signature_fn(&self, name: &str) -> bool

Whether name was introduced by a signature declaration (@name: T;) rather than by a TypR definition with a body.

Source

pub fn get_extern_r_name(&self, name: &str) -> Option<String>

Source

pub fn is_import_from_fn(&self, name: &str) -> bool

Source

pub fn get_import_from_r_name(&self, name: &str) -> Option<String>

Source

pub fn register_vectorizable_fn(self, name: &str, is_vectorizable: bool) -> Self

Record whether a user function declaration has a natively-vectorizable body. A name is only vectorizable while every declaration seen for it is — one non-vectorizable overload downgrades the entry permanently.

Source

pub fn is_vectorizable_fn(&self, name: &str) -> bool

Source

pub fn set_config(self, config: Config) -> Self

Source

pub fn set_as_module_context(self) -> Context

Source

pub fn set_test_mode(self, val: bool) -> Context

Source

pub fn get_test_mode(&self) -> bool

Source

pub fn set_checked_mode(self, val: bool) -> Context

Source

pub fn get_checked_mode(&self) -> bool

Source

pub fn set_test_preamble(self, lines: Vec<String>) -> Context

Source

pub fn set_self_type(self, self_type: Option<Type>) -> Context

Self:{ ... } (generic_constructor.md §4.1): bind/clear the type denoted by Self for the duration of typing a function body.

Source

pub fn set_expected_return_type( self, expected_return_type: Option<Type>, ) -> Context

Bind/clear the declared return type of the function whose body is currently being type-checked (audit_type_checking.md C1).

Source

pub fn get_expected_return_type(&self) -> Option<Type>

Source

pub fn store_module_inner_context(self, name: &str, inner: &Context) -> Self

Source

pub fn get_module_inner_context(&self, name: &str) -> Option<&Context>

Source

pub fn mark_module_in_progress(self, name: &str) -> Self

Mark a module as currently being type-checked. Returns the updated context with name added to modules_in_progress.

Source

pub fn unmark_module_in_progress(self, name: &str) -> Self

Remove a module from the in-progress set after its body has been fully type-checked.

Source

pub fn is_module_in_progress(&self, name: &str) -> bool

True when name is currently being type-checked (its body is on the call stack). A use {name}::*; encountered while this returns true is a circular dependency.

Source

pub fn cache_processed_module(self, name: &str, module_type: Type) -> Self

Register module_type in the processed-module cache so that subsequent use {name}::*; directives can resolve it without walking the full variable-path chain.

Source

pub fn get_processed_module(&self, name: &str) -> Option<&Type>

Look up a previously cached module by name. Returns Some(module_type) when name has already been fully type-checked in this session.

Source

pub fn set_in_module_body(self) -> Self

Source

pub fn is_in_module_body(&self) -> bool

Source

pub fn set_in_loop(self, val: bool) -> Self

See Config::in_loop — set while type-checking the body of a Loop/WhileLoop/ForLoop so break/next inside it are valid.

Source

pub fn is_in_loop(&self) -> bool

Source

pub fn with_subtypes(self, subtypes: Graph<Type>) -> Self

Retourne un nouveau Context avec le Graph de sous-typage mis à jour

Source

pub fn get_members(&self) -> Vec<(Var, Type)>

Source

pub fn variable_exist(&self, var: Var) -> Option<Var>

Source

pub fn get_type_from_variable(&self, var: &Var) -> Result<Type, String>

Source

pub fn get_types_from_name(&self, name: &str) -> Vec<Type>

Source

pub fn get_type_from_aliases(&self, var: &Var) -> Option<Type>

Source

pub fn find_alias_source_module(&self, name: &str) -> Option<String>

Search every module currently in scope (declared via module M { ... } somewhere visible, whether or not any of its members were ever brought in via use) for a public alias named name. Returns the module’s name on a hit — used to tell “genuinely undefined alias” apart from “exists, but this file never imported it” so the error can point at the fix (use M::Name;) instead of just saying “not defined”.

Source

pub fn find_variable_source_module(&self, name: &str) -> Option<(String, bool)>

Same idea as find_alias_source_module, but for ordinary names (variables and functions) rather than type aliases. Scans every module currently in scope for a member named name, checking public members first, then private ones — returns (module_name, is_public) on a hit. A private hit still points the error at use M::name; (per the fix this supports): the member exists and this is where it lives, even though that particular use will itself fail with PrivateImport until the declaration gains @pub/@export.

Source

pub fn get_matching_alias_signature( &self, var: &Var, ) -> Option<(Type, Vec<Type>)>

Source

pub fn variables(&self) -> impl Iterator<Item = &(Var, Type)> + '_

Source

pub fn aliases(&self) -> impl Iterator<Item = &(Var, Type)> + '_

Source

pub fn fresh_rigid_name(self) -> (String, Self)

Generate a fresh rigid generic variable name (immutable builder pattern).

Source

pub fn add_interface_constraint( self, rigid_name: String, interface: Type, ) -> Context

Register a constraint: rigid variable → interface type.

Source

pub fn get_interface_constraint(&self, name: &str) -> Option<&Type>

Look up the interface constraint for a rigid variable.

Source

pub fn is_rigid_constrained(&self, name: &str) -> bool

Check if a name is a constrained rigid variable.

Source

pub fn push_var_type(self, lang: Var, typ: Type, context: &Context) -> Context

Source

pub fn replace_or_push_var_type( self, lang: Var, typ: Type, context: &Context, ) -> Context

Source

pub fn remove_vars(self, vars: &[Var]) -> Context

Source

pub fn push_types(self, types: &[Type]) -> Self

Source

pub fn hoist_aliases(self, inner: &Context) -> Self

Hoists auto-generated type-alias registrations from an inner scope’s context (function body, module body) into this one — see VarType::hoist_aliases. The hoisted types are also added to the subtype graph so structural supertype lookups (S3 class chains) keep working outside the scope that registered them.

Source

pub fn get_type_from_existing_variable(&self, var: Var) -> Type

Source

pub fn get_true_variable(&self, var: &Var) -> Var

Source

pub fn is_an_untyped_function(&self, name: &str) -> bool

Source

pub fn atomic_array_elem(&self, t: &Type) -> Option<Type>

Step ③ (unification_arrays.md): does t denote an array with the bare-atomic-vector runtime representation? See VarType::atomic_array_elem — the single representation predicate.

Source

pub fn get_class(&self, t: &Type) -> String

Source

pub fn get_class_unquoted(&self, t: &Type) -> String

Source

pub fn module_aliases(&self) -> Vec<(Var, Type)>

Source

pub fn get_type_anotations(&self) -> String

Source

pub fn get_type_anotation(&self, t: &Type) -> String

Source

pub fn get_type_anotation_no_parentheses(&self, t: &Type) -> String

Source

pub fn resolves_to_foreign_alias(&self, name: &str) -> bool

Does name resolve (through alias hops) to the stdlib Foreign<T> alias? See VarType::resolves_to_foreign / get_type_anotation for the rationale (soundness_transpilation.md Phase D).

Source

pub fn get_classes(&self, t: &Type) -> Option<String>

Source

pub fn get_functions(&self, var1: Var) -> Vec<(Var, Type)>

Source

pub fn get_all_generic_functions(&self) -> Vec<(Var, Type)>

Source

pub fn get_first_matching_function(&self, var1: Var) -> Type

Source

pub fn get_matching_typed_functions(&self, var1: Var) -> Vec<Type>

Source

pub fn get_matching_untyped_functions( &self, var: Var, ) -> Result<Vec<Type>, String>

Source

pub fn get_matching_functions(&self, var: Var) -> Result<Vec<Type>, String>

Source

pub fn get_type_from_class(&self, class: &str) -> Type

Source

pub fn add_arg_types(&self, params: &[ArgumentType]) -> Context

Source

pub fn set_environment(&self, e: Environment) -> Context

Source

pub fn display_typing_context(&self) -> String

Source

pub fn error(&self, msg: String) -> String

Source

pub fn push_alias(self, alias_name: String, typ: Type) -> Self

Source

pub fn push_type_constructor( self, name: String, parameters: Vec<Type>, category: ConstructorCategory, ) -> Self

Register a user-declared typeconstructor in the registry.

Source

pub fn get_type_constructor( &self, name: &str, ) -> Option<&(String, Vec<Type>, ConstructorCategory)>

Look up a declared typeconstructor by name.

Source

pub fn push_record_alias(self, name: String, typ: Type) -> Self

Register a type X <- list { ... } record alias in the whole-program registry, regardless of the current module scope. No-op for non-record aliases. Last declaration for a given name wins.

Source

pub fn merge_record_aliases(self, other: &Context) -> Self

Merge another context’s whole-program record-alias registry into this one. Used at module boundaries, where the rest of the inner typing context is intentionally discarded for encapsulation but this registry must still bubble up (see Lang::Module in processes::type_checking).

Source

pub fn push_embedded_method( self, type_name: String, method_name: String, field_name: String, ) -> Self

Record that method_name on type_name was auto-generated by named type embedding (embed field: Type), forwarded from field_name. See processes::type_checking::embedding.

Source

pub fn get_embedded_method( &self, type_name: &str, method_name: &str, ) -> Option<String>

If method_name on type_name was inherited via named type embedding, return the source field name it was forwarded from.

Source

pub fn push_alias2(self, alias_var: Var, typ: Type) -> Self

Source

pub fn in_a_project(&self) -> bool

Source

pub fn get_unification_map( &self, entered_types: &[Type], param_types: &[Type], ) -> Option<UnificationMap>

Source

pub fn get_functions_from_type(&self, typ: &Type) -> Vec<(Var, Type)>

Source

pub fn get_functions_from_name(&self, name: &str) -> Vec<(Var, Type)>

Source

pub fn get_type_definition(&self, _functions: &VarFunction) -> String

Source

pub fn update_variable(self, var: Var) -> Self

Source

pub fn set_target_language(self, language: TargetLanguage) -> Self

Source

pub fn set_default_var_types(self) -> Self

Source

pub fn get_target_language(&self) -> TargetLanguage

Source

pub fn set_new_aliase_signature(self, alias: &str, related_type: Type) -> Self

Source

pub fn extract_module_as_vartype(&self, module_name: &str) -> Self

Source

pub fn get_vartype(&self) -> VarType

Source

pub fn get_environment(&self) -> Environment

Source

pub fn extend_typing_context(self, var_types: VarType) -> Self

Trait Implementations§

Source§

impl Add for Context

Source§

type Output = Context

The resulting type after applying the + operator.
Source§

fn add(self, other: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl Clone for Context

Source§

fn clone(&self) -> Context

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 Debug for Context

Source§

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

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

impl Default for Context

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Context

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<Context> for Translatable

Source§

fn from(val: Context) -> Self

Converts to this type from the input type.
Source§

impl From<Vec<(Lang, Type)>> for Context

Source§

fn from(val: Vec<(Lang, Type)>) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Context

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for Context

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Context

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> Conv for T

Source§

fn conv<T>(self) -> T
where Self: Into<T>,

Converts self into T using Into<T>. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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<D> OwoColorize for D

Source§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
Source§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
Source§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
Source§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
Source§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
Source§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
Source§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
Source§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
Source§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
Source§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
Source§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
Source§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
Source§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
Source§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
Source§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
Source§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
Source§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
Source§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
Source§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
Source§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
Source§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
Source§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
Source§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
Source§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
Source§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
Source§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
Source§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
Source§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
Source§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
Source§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
Source§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
Source§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
Source§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
Source§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
Source§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
Source§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
Source§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
Source§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
Source§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
Source§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
Source§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
Source§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
Source§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
Source§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
Source§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
Source§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
Source§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
Source§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
Source§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
Source§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
Source§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
Source§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
Source§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
Source§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
Source§

impl<T> Pipe for T
where T: ?Sized,

Source§

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R
where Self: Sized,

Pipes by value. This is generally the method you want to use. Read more
Source§

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R
where R: 'a,

Borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R
where R: 'a,

Mutably borrows self and passes that borrow into the pipe function. Read more
Source§

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
where Self: Borrow<B>, B: 'a + ?Sized, R: 'a,

Borrows self, then passes self.borrow() into the pipe function. Read more
Source§

fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
where Self: BorrowMut<B>, B: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more
Source§

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
where Self: AsRef<U>, U: 'a + ?Sized, R: 'a,

Borrows self, then passes self.as_ref() into the pipe function.
Source§

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
where Self: AsMut<U>, U: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.as_mut() into the pipe function.
Source§

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
where Self: Deref<Target = T>, T: 'a + ?Sized, R: 'a,

Borrows self, then passes self.deref() into the pipe function.
Source§

fn pipe_deref_mut<'a, T, R>( &'a mut self, func: impl FnOnce(&'a mut T) -> R, ) -> R
where Self: DerefMut<Target = T> + Deref, T: 'a + ?Sized, R: 'a,

Mutably borrows self, then passes self.deref_mut() into the pipe function.
Source§

impl<T> Tap for T

Source§

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more
Source§

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more
Source§

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Immutable access to the Borrow<B> of a value. Read more
Source§

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Mutable access to the BorrowMut<B> of a value. Read more
Source§

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Immutable access to the AsRef<R> view of a value. Read more
Source§

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Mutable access to the AsMut<R> view of a value. Read more
Source§

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Immutable access to the Deref::Target of a value. Read more
Source§

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Mutable access to the Deref::Target of a value. Read more
Source§

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.
Source§

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
where Self: Borrow<B>, B: ?Sized,

Calls .tap_borrow() only in debug builds, and is erased in release builds.
Source§

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
where Self: BorrowMut<B>, B: ?Sized,

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
where Self: AsRef<R>, R: ?Sized,

Calls .tap_ref() only in debug builds, and is erased in release builds.
Source§

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
where Self: AsMut<R>, R: ?Sized,

Calls .tap_ref_mut() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
where Self: Deref<Target = T>, T: ?Sized,

Calls .tap_deref() only in debug builds, and is erased in release builds.
Source§

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self
where Self: DerefMut<Target = T> + Deref, T: ?Sized,

Calls .tap_deref_mut() only in debug builds, and is erased in release builds.
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> ToSome for T

Source§

fn to_some(self) -> Option<T>

Source§

impl<T> TryConv for T

Source§

fn try_conv<T>(self) -> Result<T, Self::Error>
where Self: TryInto<T>,

Attempts to convert self into T using TryInto<T>. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.