Skip to main content

Term

Enum Term 

Source
pub enum Term {
    Var(String),
    Const(String),
    Typed {
        value: Box<Term>,
        type_annotation: TypeAnnotation,
    },
}

Variants§

§

Var(String)

§

Const(String)

§

Typed

Typed term with explicit type annotation

Fields

§value: Box<Term>
§type_annotation: TypeAnnotation

Implementations§

Source§

impl Term

Source

pub fn var(name: impl Into<String>) -> Term

Examples found in repository?
examples/00_minimal_rule/main.rs (line 11)
4fn main() {
5    println!("=== Tensorlogic Example: Minimal Rule ===\n");
6
7    // Define a simple implication rule:
8    // Parent(a, b) → Ancestor(a, b)
9    // "If a is a parent of b, then a is an ancestor of b"
10
11    let parent = TLExpr::pred("Parent", vec![Term::var("a"), Term::var("b")]);
12
13    let ancestor = TLExpr::pred("Ancestor", vec![Term::var("a"), Term::var("b")]);
14
15    let rule = TLExpr::imply(parent, ancestor);
16
17    println!("Rule: Parent(a, b) → Ancestor(a, b)");
18    println!("Compiling logic rule to tensor graph...\n");
19
20    match compile_to_einsum(&rule) {
21        Ok(plan) => {
22            println!("Compilation successful!");
23            println!("  Tensors: {}", plan.tensors.len());
24            println!("  Nodes: {}", plan.nodes.len());
25            println!("\nGenerated tensors:");
26            for (i, tensor) in plan.tensors.iter().enumerate() {
27                println!("  {}: {}", i, tensor);
28            }
29            println!("\nGenerated nodes:");
30            for (i, node) in plan.nodes.iter().enumerate() {
31                println!("  {}: {:?} (inputs: {:?})", i, node.op, node.inputs);
32            }
33        }
34        Err(e) => {
35            eprintln!("Compilation error: {}", e);
36        }
37    }
38
39    println!("\n=== Compilation Complete ===");
40}
More examples
Hide additional examples
examples/04_compilation_strategies/main.rs (line 27)
19fn main() {
20    let sep = "=".repeat(70);
21    println!("{}", sep);
22    println!("TensorLogic - Compilation Strategies Comparison");
23    println!("{}", sep);
24    println!();
25
26    // Create a simple logical expression: P(x) AND Q(x)
27    let p = TLExpr::pred("P", vec![Term::var("x")]);
28    let q = TLExpr::pred("Q", vec![Term::var("x")]);
29    let and_expr = TLExpr::and(p.clone(), q.clone());
30
31    // Test data: 5 different cases
32    // P values: [0.0, 0.2, 0.5, 0.8, 1.0]
33    // Q values: [1.0, 0.8, 0.5, 0.2, 0.0]
34    let p_data =
35        Scirs2Exec::from_vec(vec![0.0, 0.2, 0.5, 0.8, 1.0], vec![5]).expect("valid tensor data");
36    let q_data =
37        Scirs2Exec::from_vec(vec![1.0, 0.8, 0.5, 0.2, 0.0], vec![5]).expect("valid tensor data");
38
39    println!("Test Data:");
40    println!("  P(x): {:?}", p_data.as_slice().unwrap_or(&[]));
41    println!("  Q(x): {:?}", q_data.as_slice().unwrap_or(&[]));
42    println!();
43
44    // Test each compilation strategy
45    test_strategy(
46        "Soft Differentiable",
47        &and_expr,
48        &p_data,
49        &q_data,
50        CompilationConfig::soft_differentiable(),
51    );
52
53    test_strategy(
54        "Hard Boolean",
55        &and_expr,
56        &p_data,
57        &q_data,
58        CompilationConfig::hard_boolean(),
59    );
60
61    test_strategy(
62        "Fuzzy Gödel",
63        &and_expr,
64        &p_data,
65        &q_data,
66        CompilationConfig::fuzzy_godel(),
67    );
68
69    test_strategy(
70        "Fuzzy Product",
71        &and_expr,
72        &p_data,
73        &q_data,
74        CompilationConfig::fuzzy_product(),
75    );
76
77    test_strategy(
78        "Fuzzy Łukasiewicz",
79        &and_expr,
80        &p_data,
81        &q_data,
82        CompilationConfig::fuzzy_lukasiewicz(),
83    );
84
85    test_strategy(
86        "Probabilistic",
87        &and_expr,
88        &p_data,
89        &q_data,
90        CompilationConfig::probabilistic(),
91    );
92
93    println!();
94    let sep = "=".repeat(70);
95    println!("{}", sep);
96    println!("Analysis:");
97    println!("{}", sep);
98    println!();
99    println!("1. Soft Differentiable (Product):");
100    println!("   - Smooth, differentiable everywhere");
101    println!("   - Good for gradient-based optimization");
102    println!("   - Penalizes low values more");
103    println!();
104    println!("2. Hard Boolean (Min):");
105    println!("   - Exact Boolean semantics");
106    println!("   - Not differentiable at certain points");
107    println!("   - Returns minimum of inputs");
108    println!();
109    println!("3. Fuzzy Gödel (Min):");
110    println!("   - Same as Hard Boolean for AND");
111    println!("   - Part of Gödel fuzzy logic system");
112    println!();
113    println!("4. Fuzzy Product (Product):");
114    println!("   - Similar to Soft Differentiable");
115    println!("   - Standard product t-norm");
116    println!();
117    println!("5. Fuzzy Łukasiewicz (max(0, a+b-1)):");
118    println!("   - Different from other strategies");
119    println!("   - More conservative (lower values)");
120    println!("   - Good for certain applications");
121    println!();
122    println!("6. Probabilistic (Product, assumes independence):");
123    println!("   - Treats values as probabilities");
124    println!("   - P(A AND B) = P(A) * P(B) if independent");
125    println!();
126    let sep = "=".repeat(70);
127    println!("{}", sep);
128    println!();
129    println!("Note: This example demonstrates how different compilation strategies");
130    println!("affect the semantics of logical operations. Each strategy compiles");
131    println!("the same logical expression to different tensor operations.");
132    println!();
133    let sep = "=".repeat(70);
134    println!("{}", sep);
135    println!("Example Complete!");
136    println!("{}", sep);
137}
examples/01_exists_reduce/main.rs (line 22)
4fn main() {
5    println!("=== Tensorlogic Example: Exists Quantifier with Reduction ===\n");
6
7    // Define domains
8    let mut ctx = CompilerContext::new();
9    ctx.add_domain("Person", 10);
10    ctx.add_domain("City", 5);
11
12    println!("Domains defined:");
13    println!("  Person: cardinality = 10");
14    println!("  City: cardinality = 5\n");
15
16    // Example 1: Basic exists quantifier
17    // ∃z ∈ Person. Friend(x, z)
18    // "There exists a person z who is a friend of x"
19    println!("Example 1: ∃z ∈ Person. Friend(x, z)");
20    println!("  'For each person x, check if there exists a friend z'");
21
22    let friend_pred = TLExpr::pred("Friend", vec![Term::var("x"), Term::var("z")]);
23    let exists_friend = TLExpr::exists("z", "Person", friend_pred);
24
25    match compile_to_einsum_with_context(&exists_friend, &mut ctx.clone()) {
26        Ok(graph) => {
27            println!("  Compiled successfully!");
28            println!("  Tensors: {}", graph.tensors.len());
29            println!("  Nodes: {}", graph.nodes.len());
30            println!("  Graph tensors: {:?}\n", graph.tensors);
31        }
32        Err(e) => println!("  Compilation error: {}\n", e),
33    }
34
35    // Example 2: Exists with conjunction
36    // ∃z ∈ Person. (Friend(x, z) ∧ LivesIn(z, "Tokyo"))
37    // "There exists a person z who is a friend of x AND lives in Tokyo"
38    println!("Example 2: ∃z ∈ Person. (Friend(x, z) ∧ LivesIn(z, Tokyo))");
39    println!("  'For each person x, check if they have a friend in Tokyo'");
40
41    let friend_pred2 = TLExpr::pred("Friend", vec![Term::var("x"), Term::var("z")]);
42    let lives_in_tokyo = TLExpr::pred("LivesIn", vec![Term::var("z"), Term::constant("Tokyo")]);
43    let and_expr = TLExpr::and(friend_pred2, lives_in_tokyo);
44    let exists_friend_tokyo = TLExpr::exists("z", "Person", and_expr);
45
46    match compile_to_einsum_with_context(&exists_friend_tokyo, &mut ctx.clone()) {
47        Ok(graph) => {
48            println!("  Compiled successfully!");
49            println!("  Tensors: {}", graph.tensors.len());
50            println!("  Nodes: {}", graph.nodes.len());
51            for (i, tensor) in graph.tensors.iter().enumerate() {
52                println!("    Tensor {}: {}", i, tensor);
53            }
54            println!();
55        }
56        Err(e) => println!("  Compilation error: {}\n", e),
57    }
58
59    // Example 3: Nested quantifiers
60    // ∃y ∈ City. ∃z ∈ Person. (LivesIn(z, y) ∧ Friend(x, z))
61    // "There exists a city y and a person z such that z lives in y and is a friend of x"
62    println!("Example 3: ∃y ∈ City. ∃z ∈ Person. (LivesIn(z, y) ∧ Friend(x, z))");
63    println!("  'For each person x, check if they have a friend living somewhere'");
64
65    let lives_in = TLExpr::pred("LivesIn", vec![Term::var("z"), Term::var("y")]);
66    let friend = TLExpr::pred("Friend", vec![Term::var("x"), Term::var("z")]);
67    let inner_and = TLExpr::and(lives_in, friend);
68    let exists_z = TLExpr::exists("z", "Person", inner_and);
69    let exists_y_z = TLExpr::exists("y", "City", exists_z);
70
71    match compile_to_einsum_with_context(&exists_y_z, &mut ctx.clone()) {
72        Ok(graph) => {
73            println!("  Compiled successfully!");
74            println!("  Tensors: {}", graph.tensors.len());
75            println!("  Nodes: {}", graph.nodes.len());
76            println!("  This demonstrates reduction over multiple axes:");
77            for (i, node) in graph.nodes.iter().enumerate() {
78                println!("    Node {}: op = {:?}", i, node.op);
79            }
80            println!();
81        }
82        Err(e) => println!("  Compilation error: {}\n", e),
83    }
84
85    println!("=== Compilation Complete ===");
86    println!("\nNote: These examples demonstrate how existential quantifiers");
87    println!("compile to tensor reductions. The actual tensor execution would");
88    println!("happen with a backend like SciRS2.");
89}
examples/02_scirs2_execution/main.rs (line 19)
15fn main() -> anyhow::Result<()> {
16    println!("=== Tensorlogic + SciRS2: End-to-End Execution ===\n");
17
18    // 1. Define logic rule: Parent(x, y) → Ancestor(x, y)
19    let parent = TLExpr::pred("Parent", vec![Term::var("x"), Term::var("y")]);
20    let ancestor = TLExpr::pred("Ancestor", vec![Term::var("x"), Term::var("y")]);
21    let rule = TLExpr::imply(parent.clone(), ancestor.clone());
22
23    println!("Logic Rule: Parent(x, y) → Ancestor(x, y)");
24    println!("Interpretation: If Parent(x,y) holds, then Ancestor(x,y) should hold\n");
25
26    // 2. Compile to einsum graph
27    println!("Compiling to tensor graph...");
28    let graph = compile_to_einsum(&rule)?;
29    println!("  Tensors: {}", graph.tensors.len());
30    println!("  Nodes: {}", graph.nodes.len());
31
32    for (idx, tensor_name) in graph.tensors.iter().enumerate() {
33        println!("  Tensor {}: {}", idx, tensor_name);
34    }
35
36    for (idx, node) in graph.nodes.iter().enumerate() {
37        println!("  Node {}: {:?} (inputs: {:?})", idx, node.op, node.inputs);
38    }
39    println!();
40
41    // 3. Create SciRS2 executor and input tensors
42    println!("Creating SciRS2 executor...");
43    let mut executor = Scirs2Exec::new();
44
45    // Create a 3x3 Parent relation tensor (3 people, 3 people)
46    // Parent[i,j] = 1.0 if person i is parent of person j
47    let parent_data = vec![
48        0.0, 1.0, 1.0, // Person 0 is parent of 1, 2
49        0.0, 0.0, 0.0, // Person 1 has no children
50        0.0, 0.0, 0.0, // Person 2 has no children
51    ];
52
53    let parent_tensor = Scirs2Exec::from_vec(parent_data, vec![3, 3])?;
54    println!("Parent tensor shape: {:?}", parent_tensor.shape());
55    println!("Parent tensor:\n{:?}\n", parent_tensor);
56
57    // Create expected Ancestor tensor (also 3x3, same as Parent for this simple case)
58    let ancestor_data = vec![
59        0.0, 1.0, 1.0, // Person 0 is ancestor of 1, 2
60        0.0, 0.0, 0.0, // Person 1 has no descendants
61        0.0, 0.0, 0.0, // Person 2 has no descendants
62    ];
63
64    let ancestor_tensor = Scirs2Exec::from_vec(ancestor_data, vec![3, 3])?;
65    println!(
66        "Expected Ancestor tensor shape: {:?}",
67        ancestor_tensor.shape()
68    );
69    println!("Expected Ancestor tensor:\n{:?}\n", ancestor_tensor);
70
71    // Add tensors to executor storage using dynamic names from compiled graph
72    executor.add_tensor(graph.tensors[0].clone(), parent_tensor);
73    executor.add_tensor(graph.tensors[1].clone(), ancestor_tensor);
74
75    // 4. Execute the graph
76    println!("Executing forward pass...");
77    let output = executor.forward(&graph)?;
78    println!("Output tensor shape: {:?}", output.shape());
79    println!("Output tensor (constraint violation):\n{:?}\n", output);
80
81    // 5. Interpret results
82    println!("=== Interpretation ===");
83    println!("The output tensor represents constraint violations (via ReLU(Ancestor - Parent)).");
84    println!("  - Values near 0: rule satisfied (Parent implies Ancestor)");
85    println!("  - Positive values: violations (Parent holds but Ancestor doesn't)\n");
86
87    // Example 2: Test element-wise operations
88    println!("=== Testing SciRS2 Element-wise Operations ===\n");
89
90    let test_data = vec![-2.0, -1.0, 0.0, 1.0, 2.0];
91    let test_tensor = Scirs2Exec::from_vec(test_data, vec![5])?;
92
93    println!("Input: {:?}", test_tensor);
94
95    let relu_result = executor.elem_op(tensorlogic_infer::ElemOp::Relu, &test_tensor)?;
96    println!("ReLU:  {:?}", relu_result);
97
98    let sigmoid_result = executor.elem_op(tensorlogic_infer::ElemOp::Sigmoid, &test_tensor)?;
99    println!("Sigmoid: {:?}", sigmoid_result);
100
101    let one_minus_result = executor.elem_op(tensorlogic_infer::ElemOp::OneMinus, &test_tensor)?;
102    println!("OneMinus: {:?}\n", one_minus_result);
103
104    // Example 3: Test reduction operations
105    println!("=== Testing SciRS2 Reduction Operations ===\n");
106
107    let matrix_data = vec![1.0, 2.0, 3.0, 4.0, 5.0, 6.0];
108    let matrix = Scirs2Exec::from_vec(matrix_data, vec![2, 3])?;
109
110    println!("Input matrix (2x3):\n{:?}\n", matrix);
111
112    let sum_axis0 = executor.reduce(tensorlogic_infer::ReduceOp::Sum, &matrix, &[0])?;
113    println!("Sum over axis 0: {:?}", sum_axis0);
114
115    let sum_axis1 = executor.reduce(tensorlogic_infer::ReduceOp::Sum, &matrix, &[1])?;
116    println!("Sum over axis 1: {:?}", sum_axis1);
117
118    let max_axis0 = executor.reduce(tensorlogic_infer::ReduceOp::Max, &matrix, &[0])?;
119    println!("Max over axis 0: {:?}", max_axis0);
120
121    let mean_axis1 = executor.reduce(tensorlogic_infer::ReduceOp::Mean, &matrix, &[1])?;
122    println!("Mean over axis 1: {:?}\n", mean_axis1);
123
124    println!("=== Execution Complete ===");
125    println!("\nThis demonstrates the full pipeline:");
126    println!("  Logic → IR → Einsum Graph → SciRS2 Execution → Results");
127
128    Ok(())
129}
Source

pub fn constant(name: impl Into<String>) -> Term

Examples found in repository?
examples/01_exists_reduce/main.rs (line 42)
4fn main() {
5    println!("=== Tensorlogic Example: Exists Quantifier with Reduction ===\n");
6
7    // Define domains
8    let mut ctx = CompilerContext::new();
9    ctx.add_domain("Person", 10);
10    ctx.add_domain("City", 5);
11
12    println!("Domains defined:");
13    println!("  Person: cardinality = 10");
14    println!("  City: cardinality = 5\n");
15
16    // Example 1: Basic exists quantifier
17    // ∃z ∈ Person. Friend(x, z)
18    // "There exists a person z who is a friend of x"
19    println!("Example 1: ∃z ∈ Person. Friend(x, z)");
20    println!("  'For each person x, check if there exists a friend z'");
21
22    let friend_pred = TLExpr::pred("Friend", vec![Term::var("x"), Term::var("z")]);
23    let exists_friend = TLExpr::exists("z", "Person", friend_pred);
24
25    match compile_to_einsum_with_context(&exists_friend, &mut ctx.clone()) {
26        Ok(graph) => {
27            println!("  Compiled successfully!");
28            println!("  Tensors: {}", graph.tensors.len());
29            println!("  Nodes: {}", graph.nodes.len());
30            println!("  Graph tensors: {:?}\n", graph.tensors);
31        }
32        Err(e) => println!("  Compilation error: {}\n", e),
33    }
34
35    // Example 2: Exists with conjunction
36    // ∃z ∈ Person. (Friend(x, z) ∧ LivesIn(z, "Tokyo"))
37    // "There exists a person z who is a friend of x AND lives in Tokyo"
38    println!("Example 2: ∃z ∈ Person. (Friend(x, z) ∧ LivesIn(z, Tokyo))");
39    println!("  'For each person x, check if they have a friend in Tokyo'");
40
41    let friend_pred2 = TLExpr::pred("Friend", vec![Term::var("x"), Term::var("z")]);
42    let lives_in_tokyo = TLExpr::pred("LivesIn", vec![Term::var("z"), Term::constant("Tokyo")]);
43    let and_expr = TLExpr::and(friend_pred2, lives_in_tokyo);
44    let exists_friend_tokyo = TLExpr::exists("z", "Person", and_expr);
45
46    match compile_to_einsum_with_context(&exists_friend_tokyo, &mut ctx.clone()) {
47        Ok(graph) => {
48            println!("  Compiled successfully!");
49            println!("  Tensors: {}", graph.tensors.len());
50            println!("  Nodes: {}", graph.nodes.len());
51            for (i, tensor) in graph.tensors.iter().enumerate() {
52                println!("    Tensor {}: {}", i, tensor);
53            }
54            println!();
55        }
56        Err(e) => println!("  Compilation error: {}\n", e),
57    }
58
59    // Example 3: Nested quantifiers
60    // ∃y ∈ City. ∃z ∈ Person. (LivesIn(z, y) ∧ Friend(x, z))
61    // "There exists a city y and a person z such that z lives in y and is a friend of x"
62    println!("Example 3: ∃y ∈ City. ∃z ∈ Person. (LivesIn(z, y) ∧ Friend(x, z))");
63    println!("  'For each person x, check if they have a friend living somewhere'");
64
65    let lives_in = TLExpr::pred("LivesIn", vec![Term::var("z"), Term::var("y")]);
66    let friend = TLExpr::pred("Friend", vec![Term::var("x"), Term::var("z")]);
67    let inner_and = TLExpr::and(lives_in, friend);
68    let exists_z = TLExpr::exists("z", "Person", inner_and);
69    let exists_y_z = TLExpr::exists("y", "City", exists_z);
70
71    match compile_to_einsum_with_context(&exists_y_z, &mut ctx.clone()) {
72        Ok(graph) => {
73            println!("  Compiled successfully!");
74            println!("  Tensors: {}", graph.tensors.len());
75            println!("  Nodes: {}", graph.nodes.len());
76            println!("  This demonstrates reduction over multiple axes:");
77            for (i, node) in graph.nodes.iter().enumerate() {
78                println!("    Node {}: op = {:?}", i, node.op);
79            }
80            println!();
81        }
82        Err(e) => println!("  Compilation error: {}\n", e),
83    }
84
85    println!("=== Compilation Complete ===");
86    println!("\nNote: These examples demonstrate how existential quantifiers");
87    println!("compile to tensor reductions. The actual tensor execution would");
88    println!("happen with a backend like SciRS2.");
89}
Source

pub fn typed_var(name: impl Into<String>, type_name: impl Into<String>) -> Term

Create a typed variable

Source

pub fn typed_const( name: impl Into<String>, type_name: impl Into<String>, ) -> Term

Create a typed constant

Source

pub fn with_type(self, type_name: impl Into<String>) -> Term

Attach a type annotation to an existing term

Source

pub fn is_var(&self) -> bool

Source

pub fn is_const(&self) -> bool

Source

pub fn name(&self) -> &str

Source

pub fn get_type(&self) -> Option<&TypeAnnotation>

Get the type annotation if present

Source

pub fn untyped(&self) -> &Term

Get the underlying untyped term

Trait Implementations§

Source§

impl Clone for Term

Source§

fn clone(&self) -> Term

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 Term

Source§

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

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

impl<'de> Deserialize<'de> for Term

Source§

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

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

impl Display for Term

Source§

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

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

impl Eq for Term

Source§

impl Hash for Term

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Term

Source§

fn eq(&self, other: &Term) -> 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 Term

Source§

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

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

impl StructuralPartialEq for Term

Auto Trait Implementations§

§

impl Freeze for Term

§

impl RefUnwindSafe for Term

§

impl Send for Term

§

impl Sync for Term

§

impl Unpin for Term

§

impl UnsafeUnpin for Term

§

impl UnwindSafe for Term

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Node for T
where T: Clone + Eq + Hash + Send + Sync,

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more