Struct tcl::interp::Interpreter

source ·
pub struct Interpreter(/* private fields */);
Expand description

Tcl interpeter which has ownership.

Implementations§

source§

impl Interpreter

source

pub fn new() -> Result<Self, Enum2<NullInterp, TclInitError>>

Creates a Tcl interpeter.

source

pub fn into_raw_non_null(self) -> NonNull<Tcl_Interp>

Consumes the interpreter, returning a wrapped raw nonnull pointer.

Methods from Deref<Target = Interp>§

source

pub fn after_ms(&self, ms: c_int) -> Result<(), InterpError>

source

pub fn after<Scripts, Tag>( &self, ms: c_int, scripts: Scripts ) -> Result<Obj, InterpError>
where Scripts: IntoHomoTuple<Obj> + NonZeroLen<Tag>, <Scripts as IntoHomoTuple<Obj>>::Output: Into<Obj>,

In this form the command returns immediately, but it arranges for a Tcl command to be executed ms milliseconds later as an event handler. The command will be executed exactly once, at the given time. The delayed command is formed by concatenating all the script arguments in the same fashion as the concat command. The command will be executed at global level (outside the context of any Tcl procedure). If an error occurs while executing the delayed command then the background error will be reported by the command registered with interp bgerror. The after command returns an identifier that can be used to cancel the delayed command using after cancel.

§Example
use tcl::*;
use tuplex::*;

let interp = Interpreter::new().unwrap();

interp.eval( "set ::foo 1; set ::bar 2;" )?;
tclfn!( interp, cmd: "set_foo", fn set_foo() -> TclResult<()> {
    let interp = tcl_interp!();
    interp.set( "foo", 3 );
    Ok(())
});

tclfn!( interp, cmd: "set_bar", fn set_bar() -> TclResult<()> {
    let interp = tcl_interp!();
    interp.set( "bar", 4 );
    Ok(())
});

interp.after( 1000, ( "set_foo", ))?;
interp.after( 1000, ( "set_bar", ))?;

unsafe{ clib::Tcl_DoOneEvent( 0 ); }

assert_eq!( interp.get_int("foo")?, 3 );
assert_eq!( interp.get_int("bar")?, 4 );
source

pub fn after_cancel_id(&self, id: impl Into<Obj>) -> Result<(), InterpError>

source

pub fn after_cancel<Scripts, Tag>( &self, scripts: Scripts ) -> Result<(), InterpError>
where Scripts: IntoHomoTuple<Obj> + NonZeroLen<Tag>, <Scripts as IntoHomoTuple<Obj>>::Output: Into<Obj>,

source

pub fn after_idle<Scripts, Tag>( &self, scripts: Scripts ) -> Result<(), InterpError>
where Scripts: IntoHomoTuple<Obj> + NonZeroLen<Tag>, <Scripts as IntoHomoTuple<Obj>>::Output: Into<Obj>,

source

pub fn after_info_id(&self, id: Obj) -> Result<Obj, InterpError>

source

pub fn after_info(&self) -> Result<Vec<Obj>, Enum2<InterpError, NotList>>

source

pub fn as_ptr(&self) -> *mut Tcl_Interp

Obtains a raw pointer, required in Tcl’s C API.

source

pub fn result(&self) -> Obj

Returns the result of interpreter as a value.

source

pub fn error(&self) -> InterpError

Returns the result and options of interpreter as an error.

source

pub fn eval(&self, code: impl Into<Obj>) -> Result<Obj, InterpError>

Executes the code until either an error occurs or the end of the script is reached. Returns a value stored in obj on success.

source

pub fn eval_with_flags( &self, code: impl Into<Obj>, flags: c_int ) -> Result<Obj, InterpError>

Executes the code until either an error occurs or the end of the script is reached. Additional options can be specified using flags TCL_EVAL_GLOBAL and TCL_EVAL_DIRECT.

Set environment variable TCL_DISPLAY_RUNNING_COMMANDS to “stdout” or “stderr” to check what commands are running.

source

pub fn run(&self, code: impl Into<Obj>) -> Result<(), InterpError>

Executes the code until either an error occurs or the end of the script is reached. Returns () on success.

Set environment variable TCL_DISPLAY_RUNNING_COMMANDS to “stdout” or “stderr” to check what commands are running.

source

pub fn get(&self, var: impl Into<Obj>) -> Result<Obj, InterpError>

Reads the value of variable named var defined in the interpreter.

source

pub fn arr_get( &self, arr: impl Into<Obj>, elem: impl Into<Obj> ) -> Result<Obj, InterpError>

Reads the value of elem of array arr defined in the interpreter.

source

pub fn set(&self, lhs: impl Into<Obj>, rhs: impl Into<Obj>) -> Obj

Sets the value of variable named lhs defined in the interpreter to be rhs.

§Examples
use tcl::*;
let interpreter = Interpreter::new().unwrap();
let x = Obj::from("{");
interpreter.set( "x", "{" );
assert_eq!( interpreter.get("x").unwrap().to_string(), "{" );
source

pub fn set_list_elem(&self, lhs: impl Into<Obj>, rhs: impl Into<Obj>) -> Obj

Sets the value of variable named lhs defined in the interpreter to be rhs. The value will be converted to a list element. See https://www.tcl.tk/man/tcl/TclLib/SetVar.htm#M10 for more.

§Examples
use tcl::*;
let interpreter = Interpreter::new().unwrap();
interpreter.set_list_elem( "x", "{" );
assert_eq!( interpreter.get("x").unwrap().to_string(), "\\{" );
source

pub fn arr_set( &self, arr: impl Into<Obj>, elem: impl Into<Obj>, rhs: impl Into<Obj> ) -> Obj

Sets the value of elem of array arr defined in the interpreter, to be rhs.

§Examples
use tcl::*;
let interp = Interpreter::new().unwrap();
interp.arr_set( "color", "red"  , 0xff0000 );
interp.arr_set( "color", "green", 0x00ff00 );
interp.arr_set( "color", "blue" , 0x0000ff );
assert_eq!( interp.arr_get( "color", "red"   ).unwrap().as_u32(), 0xff0000 );
assert_eq!( interp.arr_get( "color", "green" ).unwrap().as_u32(), 0x00ff00 );
assert_eq!( interp.arr_get( "color", "blue"  ).unwrap().as_u32(), 0x0000ff );

tclfn!( &interp, fn rust_fn() -> TclResult<()> {
    let interp = tcl_interp!();
    assert_eq!( interp.arr_get( "color", "red"   ).unwrap().as_u32(), 0xff0000 );
    assert_eq!( interp.arr_get( "color", "green" ).unwrap().as_u32(), 0x00ff00 );
    assert_eq!( interp.arr_get( "color", "blue"  ).unwrap().as_u32(), 0x0000ff );
    Ok(())
});

interp.run( "rust_fn" ).unwrap();
source

pub fn arr_set_list_elem( &self, arr: impl Into<Obj>, elem: impl Into<Obj>, rhs: impl Into<Obj> ) -> Obj

Sets the value of elem of array arr defined in the interpreter, to be rhs. The value will be converted to a list element. See https://www.tcl.tk/man/tcl/TclLib/SetVar.htm#M10 for more.

source

pub fn append(&self, lhs: impl Into<Obj>, rhs: impl Into<Obj>) -> Obj

Append value rhs to the variable lhs defined in the interpreter.

§Examples
use tcl::*;
let interpreter = Interpreter::new().unwrap();
interpreter.append( "x", 0 );
interpreter.append( "x", 0 );
assert_eq!( interpreter.get("x").unwrap().to_string(), "00" );
source

pub fn append_list_elem(&self, lhs: impl Into<Obj>, rhs: impl Into<Obj>) -> Obj

Append value rhs to the variable lhs defined in the interpreter. The value will be converted to a list element. See https://www.tcl.tk/man/tcl/TclLib/SetVar.htm#M10 for more.

§Examples
use tcl::*;
let interpreter = Interpreter::new().unwrap();
interpreter.append_list_elem( "x", 0 );
interpreter.append_list_elem( "x", 0 );
assert_eq!( interpreter.get("x").unwrap().to_string(), "0 0" );
source

pub fn arr_append( &self, arr: impl Into<Obj>, elem: impl Into<Obj>, rhs: impl Into<Obj> ) -> Obj

Append value rhs to the variable elem of array arr, defined in the interpreter.

source

pub fn arr_append_list_elem( &self, arr: impl Into<Obj>, elem: impl Into<Obj>, rhs: impl Into<Obj> ) -> Obj

Append value rhs to the variable elem of array arr, defined in the interpreter. The value will be converted to a list element. See https://www.tcl.tk/man/tcl/TclLib/SetVar.htm#M10 for more.

source

pub fn unset(&self, var_name: &str) -> Result<(), InterpError>

This command removes one variable named var_name. If a name refers to an element of an array then that element is removed without affecting the rest of the array. If a name consists of an array name with no parenthesized index, then the entire array is deleted. An error can occur when the named variable does not exist, or the name refers to an array element but the variable is a scalar, or the name refers to a variable in a non-existent namespace.

source

pub fn unset_nocomplain(&self, var_name: &str)

This command removes one variable named var_name. If a name refers to an element of an array then that element is removed without affecting the rest of the array. If a name consists of an array name with no parenthesized index, then the entire array is deleted.

source

pub fn arr_unset( &self, arr_name: &str, elem_name: &str ) -> Result<(), InterpError>

This command removes an element named elem_name of an array named arr_name. An error can occur when the element does not exist, or the name refers to an array element but the variable is a scalar, or the name refers to the array in a non-existent namespace.

source

pub fn arr_unset_nocomplain(&self, arr_name: &str, elem_name: &str)

This command removes an element named elem_name of an array named arr_name.

source

pub fn boolean(&self, val: impl Into<Obj>) -> Result<bool, InterpError>

Converts val into a boolean value.

§Examples
use tcl::*;
let interpreter = Interpreter::new().unwrap();
assert_eq!( interpreter.boolean( false   ).unwrap(), false );
assert_eq!( interpreter.boolean( true    ).unwrap(), true  );
assert_eq!( interpreter.boolean( 0       ).unwrap(), false );
assert_eq!( interpreter.boolean( 1       ).unwrap(), true  );
assert_eq!( interpreter.boolean( 2       ).unwrap(), true  );
assert_eq!( interpreter.boolean( "0"     ).unwrap(), false );
assert_eq!( interpreter.boolean( "1"     ).unwrap(), true  );
assert_eq!( interpreter.boolean( "false" ).unwrap(), false );
assert_eq!( interpreter.boolean( "true"  ).unwrap(), true  );
assert_eq!( interpreter.boolean( "FaLsE" ).unwrap(), false );
assert_eq!( interpreter.boolean( "tRuE"  ).unwrap(), true  );
assert!(    interpreter.boolean( "Trueman" ).is_err() );
source

pub fn get_boolean(&self, var: impl Into<Obj>) -> Result<bool, InterpError>

Gets boolean value of variable var defined in the intepreter.

source

pub fn int(&self, val: impl Into<Obj>) -> Result<c_int, InterpError>

Converts val into a c_int value.

§Examples
use tcl::*;
let interpreter = Interpreter::new().unwrap();
assert_eq!( interpreter.int( 0      ).unwrap(), 0 );
assert_eq!( interpreter.int( "0"    ).unwrap(), 0 );
assert_eq!( interpreter.int( false  ).unwrap(), 0 );
assert_eq!( interpreter.int( true   ).unwrap(), 1 );
assert!(    interpreter.int( "zero" ).is_err() );
source

pub fn get_int(&self, var: impl Into<Obj>) -> Result<c_int, InterpError>

Gets c_int value of variable var defined in the intepreter.

source

pub fn set_int(&self, lhs: impl Into<Obj>, rhs: c_int) -> Obj

Sets the variable lhs’s value to be rhs, which is a c_int.

source

pub fn longlong(&self, val: impl Into<Obj>) -> Result<c_longlong, InterpError>

Converts val into a c_longlong value.

§Examples
use tcl::*;
let interpreter = Interpreter::new().unwrap();
assert_eq!( interpreter.longlong( 0      ).unwrap(), 0 );
assert_eq!( interpreter.longlong( "0"    ).unwrap(), 0 );
assert_eq!( interpreter.longlong( false  ).unwrap(), 0 );
assert_eq!( interpreter.longlong( true   ).unwrap(), 1 );
assert!(    interpreter.longlong( "zero" ).is_err() );
source

pub fn get_longlong( &self, var: impl Into<Obj> ) -> Result<c_longlong, InterpError>

Gets c_longlong value of variable var defined in the intepreter.

source

pub fn set_longlong(&self, lhs: impl Into<Obj>, rhs: c_longlong) -> Obj

Sets the variable lhs’s value to be rhs, which is a c_longlong.

source

pub fn double(&self, val: impl Into<Obj>) -> Result<c_double, InterpError>

Converts val into a c_double value.

§Examples
use tcl::*;
let interpreter = Interpreter::new().unwrap();
assert_eq!( interpreter.double( 0.0    ).unwrap(), 0.0 );
assert_eq!( interpreter.double( "0.0"  ).unwrap(), 0.0 );
assert_eq!( interpreter.double( false  ).unwrap(), 0.0 );
assert_eq!( interpreter.double( true   ).unwrap(), 1.0 );
assert!(    interpreter.double( "zero" ).is_err() );
source

pub fn get_double(&self, var: impl Into<Obj>) -> Result<c_double, InterpError>

Gets c_double value of variable var defined in the intepreter.

source

pub fn set_double(&self, lhs: impl Into<Obj>, rhs: c_double) -> Obj

Sets the variable lhs’s value to be rhs, which is a c_double.

source

pub unsafe fn def_proc_with_client_data( &self, name: &str, proc: ObjCmdProc, data: ClientData, deleter: Tcl_CmdDeleteProc )

Registers Rust function proc as a Tcl proc, with optional client data and destructor.

§Safety

According to https://doc.rust-lang.org/nomicon/ffi.html#ffi-and-panics, a panic! across an FFI boundary is undefined behavior.

Any user provided proc should not panic!. However, a #[proc] fn uses abort instead of panic, which is safe to register.

source

pub unsafe fn def_proc(&self, name: &str, proc: ObjCmdProc)

Registers Rust function proc as a Tcl proc, without client data nor destructor.

§Safety

According to https://doc.rust-lang.org/nomicon/ffi.html#ffi-and-panics, a panic! across an FFI boundary is undefined behavior.

Any user provided proc should not panic!. However, a #[proc] fn uses abort instead of panic, which is safe to register.

source

pub fn package_load( &self, name: &str, path: impl AsRef<Path> ) -> Result<Obj, InterpError>

This command is typically invoked by Tcl code that wishes to use a particular version of a particular package. The arguments indicate which package is wanted, and the command ensures that a suitable version of the package is loaded into the interpreter. If the command succeeds, it returns the version number that is loaded; otherwise it generates an error.

Note: path will be appended to auto_path.

source

pub fn package_provide(&self, name: &str, version: &str) -> c_int

This is equivalent to calling “package provide” with the specified package name and version.

source

pub fn source(&self, path: impl AsRef<Path>) -> Result<Obj, InterpError>

This command takes the contents of the specified file or resource and passes it to the Tcl interpreter as a text script. The return value from source is the return value of the last command executed in the script. If an error occurs in evaluating the contents of the script then the source command will return that error. If a return command is invoked from within the script then the remainder of the file will be skipped and the source command will return normally with the result from the return command.

The end-of-file character for files is “\32” (^Z) for all platforms. The source command will read files up to this character. This restriction does not exist for the read or gets commands, allowing for files containing code and data segments (scripted documents). If you require a “^Z” in code for string comparison, you can use “\032” or “\u001a”, which will be safely substituted by the Tcl interpreter into “^Z”.

A leading BOM (Byte order mark) contained in the file is ignored for unicode encodings (utf-8, unicode).

source

pub fn is_safe(&self) -> bool

Returns true if the interp is “safe”.

source

pub fn make_safe(&self) -> Result<(), InterpError>

Marks interp as “safe”, so that future calls to Interp::is_safe() will return true. It also removes all known potentially-unsafe core functionality (both commands and variables) from interp. However, it cannot know what parts of an extension or application are safe and does not make any attempt to remove those parts, so safety is not guaranteed after calling Interp::make_safe(). Callers will want to take care with their use of Interp::make_safe() to avoid false claims of safety. For many situations, Interp::create_child() may be a better choice, since it creates interpreters in a known-safe state.

§Example
use tcl::*;
let interpreter = Interpreter::new().unwrap();
assert!( !interpreter.is_safe() );
interpreter.make_safe().unwrap();
assert!( interpreter.is_safe() );
source

pub fn create_child( &self, name: &str, is_safe: bool ) -> Result<Interpreter, NullInterp>

Creates a new interpreter as a child of interp. It also creates a child command named name in interp which allows interp to manipulate the new child. If is_safe is false, the command creates a trusted child in which Tcl code has access to all the Tcl commands. If it is true, the command creates a “safe” child in which Tcl code has access only to set of Tcl commands defined as “Safe Tcl”; see the manual entry for the Tcl interp command for details.

§Example
use tcl::*;
let interpreter = Interpreter::new().unwrap();
let unsafe_child = interpreter.create_child( "an_unsafe_child", false ).unwrap();
unsafe_child.run("puts {hello,world!}").unwrap(); // ok
let safe_child = interpreter.create_child( "a_safe_child", true ).unwrap();
assert!( safe_child.run("puts {hello,world!}").is_err() ); // safe interp not allowed to output
source

pub unsafe fn get_child(&self, name: &str) -> Option<Interp>

Returns a child interp, which is identified by childName.

§Safety

Don’t access to the child Interp after the dropping of child Interpreter.

use tcl::*;
let interpreter = Interpreter::new().unwrap();
let child_interp;
{
    let child_interpreter = interpreter.create_child( "a_child_interp", false ).unwrap();
    child_interpreter.run("puts {hello,world!}").unwrap(); // ok
    child_interp = unsafe{ interpreter.get_child( "a_child_interp" ).unwrap() };
    child_interp.run("puts {hello,world!}").unwrap(); // ok
}
// DO NOT DO THIS: child_interp.run("puts {hello,world!}").unwrap(); // oops!
source

pub unsafe fn get_parent(&self) -> Option<Interp>

Returns the parent interp.

§Safety

Don’t access to the parent Interp after the dropping of parent Interpreter.

use tcl::*;
let parent_interp;
{
    let parent_interpreter = Interpreter::new().unwrap();
    let child_interpreter = parent_interpreter.create_child( "a_child_interp", false ).unwrap();
    parent_interp = unsafe{ child_interpreter.get_parent().unwrap() };
    parent_interp.run("puts {hello,world!}").unwrap(); // ok
}
// DO NOT DO THIS: parent_interp.run("puts {hello,world!}").unwrap(); // oops!
source

pub fn expose_command( &self, hidden_cmd_name: &str, cmd_name: &str ) -> Result<(), InterpError>

Moves the command named hidden_cmd_name from the set of hidden commands to the set of exposed commands, putting it under the name cmd_name. hidden_cmd_name must be the name of an existing hidden command, or Err will be returned. cmd_name already exists, the operation returns Err. After executing this command, attempts to use cmd_name in any script evaluation mechanism will again succeed.

use tcl::*;
let interpreter = Interpreter::new().unwrap();
interpreter.make_safe().unwrap();
assert!( interpreter.run("pwd").is_err() );
interpreter.expose_command( "pwd", "do_pwd" ).unwrap();
assert!( interpreter.run("do_pwd").is_ok() );
source

pub fn hide_command( &self, cmd_name: &str, hidden_cmd_name: &str ) -> Result<(), InterpError>

Moves the command named cmd_name from the set of exposed commands to the set of hidden commands, under the name hidden_cmd_name. cmd_name must be the name of an existing exposed command, or Err will be returned. Currently both cmd_name and hidden_cmd_name must not contain namespace qualifiers, or Err will be returned. The cmd_name will be looked up in the global namespace, and not relative to the current namespace, even if the current namespace is not the global one. If a hidden command whose name is hidden_cmd_name already exists, Err will also be returned. After executing this command, attempts to use cmd_name in any script evaluation mechanism will fail.

use tcl::*;
let interpreter = Interpreter::new().unwrap();
assert!( interpreter.run("pwd").is_ok() );
interpreter.hide_command( "pwd", "hide_pwd" ).unwrap();
assert!( interpreter.run("pwd").is_err() );
source

pub fn trace_add_command_rename( &self, name: impl Into<Obj>, command: impl Into<Obj> ) -> Result<(), InterpError>

source

pub fn trace_add_command_delete( &self, name: impl Into<Obj>, command: impl Into<Obj> ) -> Result<(), InterpError>

source

pub fn trace_add_execution_enter( &self, name: impl Into<Obj>, command: impl Into<Obj> ) -> Result<(), InterpError>

source

pub fn trace_add_execution_leave( &self, name: impl Into<Obj>, command: impl Into<Obj> ) -> Result<(), InterpError>

source

pub fn trace_add_execution_enter_step( &self, name: impl Into<Obj>, command: impl Into<Obj> ) -> Result<(), InterpError>

source

pub fn trace_add_execution_leave_step( &self, name: impl Into<Obj>, command: impl Into<Obj> ) -> Result<(), InterpError>

source

pub fn trace_add_variable_array( &self, name: impl Into<Obj>, command: impl Into<Obj> ) -> Result<(), InterpError>

source

pub fn trace_add_variable_read( &self, name: impl Into<Obj>, command: impl Into<Obj> ) -> Result<(), InterpError>

source

pub fn trace_add_variable_write( &self, name: impl Into<Obj>, command: impl Into<Obj> ) -> Result<(), InterpError>

source

pub fn trace_add_variable_unset( &self, name: impl Into<Obj>, command: impl Into<Obj> ) -> Result<(), InterpError>

source

pub fn trace_remove_command_rename( &self, name: impl Into<Obj>, command: impl Into<Obj> ) -> Result<(), InterpError>

source

pub fn trace_remove_command_delete( &self, name: impl Into<Obj>, command: impl Into<Obj> ) -> Result<(), InterpError>

source

pub fn trace_remove_execution_enter( &self, name: impl Into<Obj>, command: impl Into<Obj> ) -> Result<(), InterpError>

source

pub fn trace_remove_execution_leave( &self, name: impl Into<Obj>, command: impl Into<Obj> ) -> Result<(), InterpError>

source

pub fn trace_remove_execution_enter_step( &self, name: impl Into<Obj>, command: impl Into<Obj> ) -> Result<(), InterpError>

source

pub fn trace_remove_execution_leave_step( &self, name: impl Into<Obj>, command: impl Into<Obj> ) -> Result<(), InterpError>

source

pub fn trace_remove_variable_array( &self, name: impl Into<Obj>, command: impl Into<Obj> ) -> Result<(), InterpError>

source

pub fn trace_remove_variable_read( &self, name: impl Into<Obj>, command: impl Into<Obj> ) -> Result<(), InterpError>

source

pub fn trace_remove_variable_write( &self, name: impl Into<Obj>, command: impl Into<Obj> ) -> Result<(), InterpError>

source

pub fn trace_remove_variable_unset( &self, name: impl Into<Obj>, command: impl Into<Obj> ) -> Result<(), InterpError>

source

pub fn trace_info_command( &self, name: impl Into<Obj> ) -> Result<Vec<OpCommand>, Enum2<DeError, InterpError>>

source

pub fn trace_info_execution( &self, name: impl Into<Obj> ) -> Result<Vec<OpCommand>, Enum2<DeError, InterpError>>

source

pub fn trace_info_variable( &self, name: impl Into<Obj> ) -> Result<Vec<OpCommand>, Enum2<DeError, InterpError>>

source

pub fn update(&self) -> Result<(), InterpError>

source

pub fn update_idletasks(&self) -> Result<(), InterpError>

Trait Implementations§

source§

impl Deref for Interpreter

§

type Target = Interp

The resulting type after dereferencing.
source§

fn deref(&self) -> &Interp

Dereferences the value.
source§

impl Drop for Interpreter

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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<Enum> Error for Enum

source§

fn error<T, Dest, Index>(self) -> Result<T, Dest>
where Self: Sized + ExchangeInto<Dest, Index>,

source§

impl<_I0, _T0, Src, Dest> ExchangeFrom<Src, EnumToEnum<(_I0,)>> for Dest
where Src: Proto<Type = __1<_T0>>, Dest: ExchangeFrom<_T0, _I0>,

source§

fn exchange_from(src: Src) -> Dest

source§

impl<_I0, _I1, _T0, _T1, Src, Dest> ExchangeFrom<Src, EnumToEnum<(_I0, _I1)>> for Dest
where Src: Proto<Type = __2<_T0, _T1>>, Dest: ExchangeFrom<_T0, _I0> + ExchangeFrom<_T1, _I1>,

source§

fn exchange_from(src: Src) -> Dest

source§

impl<_I0, _I1, _I2, _T0, _T1, _T2, Src, Dest> ExchangeFrom<Src, EnumToEnum<(_I0, _I1, _I2)>> for Dest
where Src: Proto<Type = __3<_T0, _T1, _T2>>, Dest: ExchangeFrom<_T0, _I0> + ExchangeFrom<_T1, _I1> + ExchangeFrom<_T2, _I2>,

source§

fn exchange_from(src: Src) -> Dest

source§

impl<_I0, _I1, _I2, _I3, _T0, _T1, _T2, _T3, Src, Dest> ExchangeFrom<Src, EnumToEnum<(_I0, _I1, _I2, _I3)>> for Dest
where Src: Proto<Type = __4<_T0, _T1, _T2, _T3>>, Dest: ExchangeFrom<_T0, _I0> + ExchangeFrom<_T1, _I1> + ExchangeFrom<_T2, _I2> + ExchangeFrom<_T3, _I3>,

source§

fn exchange_from(src: Src) -> Dest

source§

impl<_I0, _I1, _I2, _I3, _I4, _T0, _T1, _T2, _T3, _T4, Src, Dest> ExchangeFrom<Src, EnumToEnum<(_I0, _I1, _I2, _I3, _I4)>> for Dest
where Src: Proto<Type = __5<_T0, _T1, _T2, _T3, _T4>>, Dest: ExchangeFrom<_T0, _I0> + ExchangeFrom<_T1, _I1> + ExchangeFrom<_T2, _I2> + ExchangeFrom<_T3, _I3> + ExchangeFrom<_T4, _I4>,

source§

fn exchange_from(src: Src) -> Dest

source§

impl<_I0, _I1, _I2, _I3, _I4, _I5, _T0, _T1, _T2, _T3, _T4, _T5, Src, Dest> ExchangeFrom<Src, EnumToEnum<(_I0, _I1, _I2, _I3, _I4, _I5)>> for Dest
where Src: Proto<Type = __6<_T0, _T1, _T2, _T3, _T4, _T5>>, Dest: ExchangeFrom<_T0, _I0> + ExchangeFrom<_T1, _I1> + ExchangeFrom<_T2, _I2> + ExchangeFrom<_T3, _I3> + ExchangeFrom<_T4, _I4> + ExchangeFrom<_T5, _I5>,

source§

fn exchange_from(src: Src) -> Dest

source§

impl<_I0, _I1, _I2, _I3, _I4, _I5, _I6, _T0, _T1, _T2, _T3, _T4, _T5, _T6, Src, Dest> ExchangeFrom<Src, EnumToEnum<(_I0, _I1, _I2, _I3, _I4, _I5, _I6)>> for Dest
where Src: Proto<Type = __7<_T0, _T1, _T2, _T3, _T4, _T5, _T6>>, Dest: ExchangeFrom<_T0, _I0> + ExchangeFrom<_T1, _I1> + ExchangeFrom<_T2, _I2> + ExchangeFrom<_T3, _I3> + ExchangeFrom<_T4, _I4> + ExchangeFrom<_T5, _I5> + ExchangeFrom<_T6, _I6>,

source§

fn exchange_from(src: Src) -> Dest

source§

impl<_I0, _I1, _I2, _I3, _I4, _I5, _I6, _I7, _T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7, Src, Dest> ExchangeFrom<Src, EnumToEnum<(_I0, _I1, _I2, _I3, _I4, _I5, _I6, _I7)>> for Dest
where Src: Proto<Type = __8<_T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7>>, Dest: ExchangeFrom<_T0, _I0> + ExchangeFrom<_T1, _I1> + ExchangeFrom<_T2, _I2> + ExchangeFrom<_T3, _I3> + ExchangeFrom<_T4, _I4> + ExchangeFrom<_T5, _I5> + ExchangeFrom<_T6, _I6> + ExchangeFrom<_T7, _I7>,

source§

fn exchange_from(src: Src) -> Dest

source§

impl<_I0, _I1, _I2, _I3, _I4, _I5, _I6, _I7, _I8, _T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, Src, Dest> ExchangeFrom<Src, EnumToEnum<(_I0, _I1, _I2, _I3, _I4, _I5, _I6, _I7, _I8)>> for Dest
where Src: Proto<Type = __9<_T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8>>, Dest: ExchangeFrom<_T0, _I0> + ExchangeFrom<_T1, _I1> + ExchangeFrom<_T2, _I2> + ExchangeFrom<_T3, _I3> + ExchangeFrom<_T4, _I4> + ExchangeFrom<_T5, _I5> + ExchangeFrom<_T6, _I6> + ExchangeFrom<_T7, _I7> + ExchangeFrom<_T8, _I8>,

source§

fn exchange_from(src: Src) -> Dest

source§

impl<_I0, _I1, _I2, _I3, _I4, _I5, _I6, _I7, _I8, _I9, _T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, Src, Dest> ExchangeFrom<Src, EnumToEnum<(_I0, _I1, _I2, _I3, _I4, _I5, _I6, _I7, _I8, _I9)>> for Dest
where Src: Proto<Type = __10<_T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9>>, Dest: ExchangeFrom<_T0, _I0> + ExchangeFrom<_T1, _I1> + ExchangeFrom<_T2, _I2> + ExchangeFrom<_T3, _I3> + ExchangeFrom<_T4, _I4> + ExchangeFrom<_T5, _I5> + ExchangeFrom<_T6, _I6> + ExchangeFrom<_T7, _I7> + ExchangeFrom<_T8, _I8> + ExchangeFrom<_T9, _I9>,

source§

fn exchange_from(src: Src) -> Dest

source§

impl<_I0, _I1, _I2, _I3, _I4, _I5, _I6, _I7, _I8, _I9, _I10, _T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, Src, Dest> ExchangeFrom<Src, EnumToEnum<(_I0, _I1, _I2, _I3, _I4, _I5, _I6, _I7, _I8, _I9, _I10)>> for Dest
where Src: Proto<Type = __11<_T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10>>, Dest: ExchangeFrom<_T0, _I0> + ExchangeFrom<_T1, _I1> + ExchangeFrom<_T2, _I2> + ExchangeFrom<_T3, _I3> + ExchangeFrom<_T4, _I4> + ExchangeFrom<_T5, _I5> + ExchangeFrom<_T6, _I6> + ExchangeFrom<_T7, _I7> + ExchangeFrom<_T8, _I8> + ExchangeFrom<_T9, _I9> + ExchangeFrom<_T10, _I10>,

source§

fn exchange_from(src: Src) -> Dest

source§

impl<_I0, _I1, _I2, _I3, _I4, _I5, _I6, _I7, _I8, _I9, _I10, _I11, _T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, Src, Dest> ExchangeFrom<Src, EnumToEnum<(_I0, _I1, _I2, _I3, _I4, _I5, _I6, _I7, _I8, _I9, _I10, _I11)>> for Dest
where Src: Proto<Type = __12<_T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11>>, Dest: ExchangeFrom<_T0, _I0> + ExchangeFrom<_T1, _I1> + ExchangeFrom<_T2, _I2> + ExchangeFrom<_T3, _I3> + ExchangeFrom<_T4, _I4> + ExchangeFrom<_T5, _I5> + ExchangeFrom<_T6, _I6> + ExchangeFrom<_T7, _I7> + ExchangeFrom<_T8, _I8> + ExchangeFrom<_T9, _I9> + ExchangeFrom<_T10, _I10> + ExchangeFrom<_T11, _I11>,

source§

fn exchange_from(src: Src) -> Dest

source§

impl<_I0, _I1, _I2, _I3, _I4, _I5, _I6, _I7, _I8, _I9, _I10, _I11, _I12, _T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, Src, Dest> ExchangeFrom<Src, EnumToEnum<(_I0, _I1, _I2, _I3, _I4, _I5, _I6, _I7, _I8, _I9, _I10, _I11, _I12)>> for Dest
where Src: Proto<Type = __13<_T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12>>, Dest: ExchangeFrom<_T0, _I0> + ExchangeFrom<_T1, _I1> + ExchangeFrom<_T2, _I2> + ExchangeFrom<_T3, _I3> + ExchangeFrom<_T4, _I4> + ExchangeFrom<_T5, _I5> + ExchangeFrom<_T6, _I6> + ExchangeFrom<_T7, _I7> + ExchangeFrom<_T8, _I8> + ExchangeFrom<_T9, _I9> + ExchangeFrom<_T10, _I10> + ExchangeFrom<_T11, _I11> + ExchangeFrom<_T12, _I12>,

source§

fn exchange_from(src: Src) -> Dest

source§

impl<_I0, _I1, _I2, _I3, _I4, _I5, _I6, _I7, _I8, _I9, _I10, _I11, _I12, _I13, _T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13, Src, Dest> ExchangeFrom<Src, EnumToEnum<(_I0, _I1, _I2, _I3, _I4, _I5, _I6, _I7, _I8, _I9, _I10, _I11, _I12, _I13)>> for Dest
where Src: Proto<Type = __14<_T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13>>, Dest: ExchangeFrom<_T0, _I0> + ExchangeFrom<_T1, _I1> + ExchangeFrom<_T2, _I2> + ExchangeFrom<_T3, _I3> + ExchangeFrom<_T4, _I4> + ExchangeFrom<_T5, _I5> + ExchangeFrom<_T6, _I6> + ExchangeFrom<_T7, _I7> + ExchangeFrom<_T8, _I8> + ExchangeFrom<_T9, _I9> + ExchangeFrom<_T10, _I10> + ExchangeFrom<_T11, _I11> + ExchangeFrom<_T12, _I12> + ExchangeFrom<_T13, _I13>,

source§

fn exchange_from(src: Src) -> Dest

source§

impl<_I0, _I1, _I2, _I3, _I4, _I5, _I6, _I7, _I8, _I9, _I10, _I11, _I12, _I13, _I14, _T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13, _T14, Src, Dest> ExchangeFrom<Src, EnumToEnum<(_I0, _I1, _I2, _I3, _I4, _I5, _I6, _I7, _I8, _I9, _I10, _I11, _I12, _I13, _I14)>> for Dest
where Src: Proto<Type = __15<_T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13, _T14>>, Dest: ExchangeFrom<_T0, _I0> + ExchangeFrom<_T1, _I1> + ExchangeFrom<_T2, _I2> + ExchangeFrom<_T3, _I3> + ExchangeFrom<_T4, _I4> + ExchangeFrom<_T5, _I5> + ExchangeFrom<_T6, _I6> + ExchangeFrom<_T7, _I7> + ExchangeFrom<_T8, _I8> + ExchangeFrom<_T9, _I9> + ExchangeFrom<_T10, _I10> + ExchangeFrom<_T11, _I11> + ExchangeFrom<_T12, _I12> + ExchangeFrom<_T13, _I13> + ExchangeFrom<_T14, _I14>,

source§

fn exchange_from(src: Src) -> Dest

source§

impl<_I0, _I1, _I2, _I3, _I4, _I5, _I6, _I7, _I8, _I9, _I10, _I11, _I12, _I13, _I14, _I15, _T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13, _T14, _T15, Src, Dest> ExchangeFrom<Src, EnumToEnum<(_I0, _I1, _I2, _I3, _I4, _I5, _I6, _I7, _I8, _I9, _I10, _I11, _I12, _I13, _I14, _I15)>> for Dest
where Src: Proto<Type = __16<_T0, _T1, _T2, _T3, _T4, _T5, _T6, _T7, _T8, _T9, _T10, _T11, _T12, _T13, _T14, _T15>>, Dest: ExchangeFrom<_T0, _I0> + ExchangeFrom<_T1, _I1> + ExchangeFrom<_T2, _I2> + ExchangeFrom<_T3, _I3> + ExchangeFrom<_T4, _I4> + ExchangeFrom<_T5, _I5> + ExchangeFrom<_T6, _I6> + ExchangeFrom<_T7, _I7> + ExchangeFrom<_T8, _I8> + ExchangeFrom<_T9, _I9> + ExchangeFrom<_T10, _I10> + ExchangeFrom<_T11, _I11> + ExchangeFrom<_T12, _I12> + ExchangeFrom<_T13, _I13> + ExchangeFrom<_T14, _I14> + ExchangeFrom<_T15, _I15>,

source§

fn exchange_from(src: Src) -> Dest

source§

impl<Src, Dest, Index> ExchangeInto<Dest, Index> for Src
where Dest: ExchangeFrom<Src, Index>,

source§

fn exchange_into(self) -> Dest

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<Enum, Variant, Index> IntoEnum<Enum, Index> for Variant
where Enum: FromVariant<Variant, Index>,

source§

fn into_enum(self) -> Enum

source§

impl<Src, Dest> IntoTuple<Dest> for Src
where Dest: FromTuple<Src>,

source§

fn into_tuple(self) -> Dest

source§

impl<T, E> Ret<Result<T, E>, _WrapOk> for T

source§

fn ret(self) -> Result<T, E>

source§

impl<T, E, A> RetLog<Result<T, E>, A, _WrapOk> for T
where A: LogAgent,

source§

fn ret_log(self, _item: impl Fn() -> <A as LogAgent>::Item) -> Result<T, E>

source§

impl<T, E, F, I> Throw<Result<T, F>, _WrapErr<I>> for E
where E: ExchangeInto<F, I>,

source§

fn throw(self) -> Result<T, F>

source§

impl<T, E, F, A, I> ThrowLog<Result<T, F>, A, _ToLog<I>> for E
where A: LogAgent, E: ToLog<A>, Log<E, A>: ExchangeInto<F, I>,

source§

fn throw_log(self, item: impl Fn() -> <A as LogAgent>::Item) -> Result<T, F>

source§

impl<Inner, Agent> ToLog<Agent> for Inner
where Agent: LogAgent,

source§

fn new_log(self) -> Log<Inner, Agent>

source§

fn to_log(self, item: <Agent as LogAgent>::Item) -> Log<Inner, Agent>

source§

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

§

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>,

§

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.