Skip to main content

KernelConfig

Struct KernelConfig 

Source
pub struct KernelConfig {
    pub state_path: Option<String>,
    pub autosave: bool,
    pub auto_checkpoint_on_patch: bool,
    pub error_threshold: f64,
    pub min_steps_between_patches: u64,
    pub max_risk: f64,
    pub default_goal: Option<String>,
    pub intervention: InterventionPolicy,
    pub self_modify_enabled: bool,
    pub dump_trajectory: bool,
}
Expand description

Serializable product config (omega.toml).

Fields§

§state_path: Option<String>

Path for state.json (relative or absolute).

§autosave: bool§auto_checkpoint_on_patch: bool§error_threshold: f64

L1 reflector: mean-error threshold that can trigger a patch.

§min_steps_between_patches: u64

L1 reflector: minimum steps between accepted patches.

§max_risk: f64

L0 constraint: max_risk used in decision scoring.

§default_goal: Option<String>

Optional initial goal string for CLI convenience (not enforced by Kernel).

§intervention: InterventionPolicy

Optional strategy-governance policy (friction + domain mode).

§self_modify_enabled: bool

Master switch for autonomous cognitive code / rule evolution (L1 patches). Default false — self-modification only when explicitly enabled.

§dump_trajectory: bool

If true, every step appends a full trajectory record to trajectory.jsonl beside the state file. Default true for auditability.

Implementations§

Source§

impl KernelConfig

Source

pub fn from_toml(s: &str) -> Result<Self>

Source

pub fn load(path: impl AsRef<Path>) -> Result<Self>

Examples found in repository?
examples/config_and_dir.rs (line 44)
10fn main() -> Result<()> {
11    let work = temp_dir().join(format!(
12        "omega-phase1-{}",
13        omega_cognitive_kernel::new_uuid()
14    ));
15    std::fs::create_dir_all(&work).expect("mkdir");
16    std::fs::write(work.join("signal.txt"), b"load=0.4").expect("write signal");
17
18    let cfg_path = work.join("omega.toml");
19    let state_path = work.join("state.json");
20    let cfg = KernelConfig {
21        state_path: Some(state_path.display().to_string()),
22        autosave: false,
23        auto_checkpoint_on_patch: false,
24        max_risk: 0.5,
25        error_threshold: 0.28,
26        ..KernelConfig::default()
27    };
28    cfg.save(&cfg_path)?;
29
30    println!("config: {}", cfg_path.display());
31    println!("watching dir: {}", work.display());
32
33    let observer = DirSnapshotObserver::new(&work).max_entries(32);
34    let executor = LoggingExecutor::new([
35        "noop".into(),
36        "observe".into(),
37        "explore".into(),
38        "exploit".into(),
39        "stabilize".into(),
40    ])
41    .echo_stdout(true);
42
43    let mut kernel = Kernel::with_adapters_and_path(observer, executor, &state_path);
44    kernel.apply_config(&KernelConfig::load(&cfg_path)?);
45
46    let report = kernel.run("monitor drop directory and stabilize under uncertainty", 4)?;
47    println!(
48        "\nsteps={} err {:.3}→{:.3} decreased={} actions={:?}",
49        report.steps,
50        report.early_avg_err,
51        report.final_avg_err,
52        report.error_decreased,
53        report.last_actions
54    );
55    println!("max_risk now {}", kernel.status().max_risk);
56
57    let _ = std::fs::remove_dir_all(&work);
58    Ok(())
59}
More examples
Hide additional examples
examples/drop_inbox_loop.rs (line 65)
19fn main() -> Result<()> {
20    let root = temp_dir().join(format!(
21        "omega-inbox-{}",
22        omega_cognitive_kernel::new_uuid()
23    ));
24    let inbox = root.join("inbox");
25    let cfg_path = root.join("omega.toml");
26    let state_path = root.join("state.json");
27    let action_log = root.join("actions.log");
28
29    fs::create_dir_all(&inbox).expect("mkdir inbox");
30
31    let cfg = KernelConfig {
32        state_path: Some(state_path.display().to_string()),
33        autosave: true,
34        auto_checkpoint_on_patch: true,
35        error_threshold: 0.28,
36        min_steps_between_patches: 2,
37        max_risk: 0.55,
38        default_goal: Some("stabilize under inbox load and keep audit trail".into()),
39        ..KernelConfig::default()
40    };
41    cfg.save(&cfg_path)?;
42
43    println!("=== Omega drop-inbox loop ===");
44    println!("root   : {}", root.display());
45    println!("inbox  : {}", inbox.display());
46    println!("config : {}", cfg_path.display());
47    println!("actions: {}", action_log.display());
48    println!();
49
50    // Seed a few "arrivals" so the first observations are non-empty.
51    fs::write(inbox.join("job-001.txt"), b"priority=low").ok();
52
53    let observer = DirSnapshotObserver::new(&inbox).max_entries(128);
54    let executor = LoggingExecutor::new([
55        "noop".into(),
56        "observe".into(),
57        "explore".into(),
58        "exploit".into(),
59        "stabilize".into(),
60    ])
61    .with_log_file(&action_log)
62    .echo_stdout(true);
63
64    let mut kernel = Kernel::with_adapters_and_path(observer, executor, &state_path);
65    kernel.apply_config(&KernelConfig::load(&cfg_path)?);
66
67    let goal = cfg
68        .default_goal
69        .clone()
70        .unwrap_or_else(|| "stabilize under inbox load".into());
71
72    // Simulate an external producer while the kernel runs.
73    for step in 1..=8u32 {
74        // "World" side: more files → more load signal in dir snapshot.
75        if step % 2 == 0 {
76            let name = format!("job-{:03}.txt", step + 10);
77            let body = format!("priority=high step={step}");
78            let _ = fs::write(inbox.join(name), body);
79            println!("[world] dropped file into inbox (step {step})");
80        }
81
82        let r = kernel.step(&goal)?;
83        let act = r
84            .trajectory
85            .actions
86            .first()
87            .map(|a| a.name.as_str())
88            .unwrap_or("-");
89        let st = kernel.status();
90        println!(
91            "[kernel] step={step} act={act:<9} patched={} avg_err={:.3} damp={:.2} max_risk={:.2}",
92            r.l1.patched, st.avg_prediction_error, st.error_damping, st.max_risk
93        );
94
95        thread::sleep(Duration::from_millis(30));
96    }
97
98    kernel.save()?;
99
100    println!("\n── summary ──");
101    let st = kernel.status();
102    println!(
103        "steps={}  avg_err={:.3}  modules={}  ckpts={}",
104        st.total_steps, st.avg_prediction_error, st.active_modules, st.checkpoint_count
105    );
106    if action_log.exists() {
107        let log = fs::read_to_string(&action_log).unwrap_or_default();
108        let lines = log.lines().count();
109        println!("action log lines: {lines}  ({})", action_log.display());
110    }
111    println!("\nCleanup: remove {}", root.display());
112    let _ = fs::remove_dir_all(&root);
113    Ok(())
114}
examples/inbox_vertical.rs (line 265)
217fn main() -> Result<()> {
218    let keep = env::var("KEEP_INBOX").ok().as_deref() == Some("1");
219    let root = if keep {
220        PathBuf::from("./omega-inbox-demo")
221    } else {
222        env::temp_dir().join(format!(
223            "omega-inbox-demo-{}",
224            omega_cognitive_kernel::new_uuid()
225        ))
226    };
227    let _ = fs::remove_dir_all(&root);
228    fs::create_dir_all(&root).expect("mkdir");
229
230    let state_path = root.join("state.json");
231    let cfg_path = root.join("omega.toml");
232    let actions_path = root.join("actions.log");
233
234    // Tight cooldown so the demo is likely to show at least one patch under load.
235    let cfg = KernelConfig {
236        state_path: Some(state_path.display().to_string()),
237        autosave: true,
238        auto_checkpoint_on_patch: true,
239        error_threshold: 0.25,
240        min_steps_between_patches: 2,
241        max_risk: 0.50,
242        default_goal: Some(
243            "drain inbox under rising load; prefer stabilize when pressure high".into(),
244        ),
245        ..KernelConfig::default()
246    };
247    cfg.save(&cfg_path)?;
248
249    println!("╔══════════════════════════════════════════════════╗");
250    println!("║  Omega Inbox Vertical — pluggable observe/act    ║");
251    println!("╚══════════════════════════════════════════════════╝");
252    println!("workspace : {}", root.display());
253    println!("config    : {}", cfg_path.display());
254    println!("state     : {}", state_path.display());
255    println!("actions   : {}", actions_path.display());
256    println!("audit     : beside state (audit.jsonl)");
257    println!();
258
259    let inbox = EventInbox::default();
260
261    // ── Mount plugins (this is the whole integration surface) ───────────────
262    let observer = EventQueueObserver::new(inbox.clone());
263    let executor = PolicyGateExecutor::new(whitelist(), &actions_path);
264    let mut kernel = Kernel::with_adapters_and_path(observer, executor, &state_path);
265    kernel.apply_config(&KernelConfig::load(&cfg_path)?);
266
267    let goal = cfg.default_goal.clone().unwrap();
268
269    // Scripted "external producer" stream of text/events.
270    let script: &[(&str, &str, u8)] = &[
271        ("e1", "user signup from region=us-east", 1),
272        ("e2", "batch job: reindex catalog", 2),
273        ("e3", "ALERT: queue lag 2.1s", 5),
274        ("e4", "ALERT: error rate spike 4%", 5),
275        ("e5", "deploy canary 10%", 3),
276        ("e6", "ALERT: disk pressure 92%", 5),
277        ("e7", "customer ticket #4412 escalated", 4),
278        ("e8", "nightly backup complete", 1),
279        ("e9", "ALERT: p99 latency 1.8s", 5),
280        ("e10", "scale-out request from autoscaler", 3),
281    ];
282
283    println!("── live stream ──");
284    for (i, (id, text, pri)) in script.iter().enumerate() {
285        let step = (i + 1) as u32;
286        inbox.push(*id, *text, *pri);
287        println!(
288            "[world] +{id} pri={pri} depth={}  «{}»",
289            inbox.len(),
290            truncate(text, 40)
291        );
292
293        let r = kernel.step(&goal)?;
294        let act = r
295            .trajectory
296            .actions
297            .first()
298            .map(|a| a.name.as_str())
299            .unwrap_or("-");
300        let st = kernel.status();
301        print!(
302            "[kernel] step={step:<2} act={act:<9} patched={:<5} err={:.3} damp={:.2}",
303            r.l1.patched, st.avg_prediction_error, st.error_damping
304        );
305        if r.l1.patched {
306            print!("  ★ RuleEffect committed");
307        }
308        println!();
309    }
310
311    kernel.save()?;
312
313    // ── Evidence operators care about ───────────────────────────────────────
314    println!("\n── status ──");
315    let st = kernel.status();
316    println!(
317        "steps={}  avg_err={:.3}  damp={:.3}  explore={:.3}  risk_tol={:.3}  max_risk={:.2}",
318        st.total_steps,
319        st.avg_prediction_error,
320        st.error_damping,
321        st.explore_bonus,
322        st.risk_tolerance,
323        st.max_risk
324    );
325    println!(
326        "modules={}  checkpoints={}  L2 in_fp={} align={:.3}",
327        st.active_modules, st.checkpoint_count, st.in_fixed_point, st.last_alignment_score
328    );
329
330    println!("\n── audit.jsonl (tail) ──");
331    match kernel.audit_tail(12) {
332        Ok(rows) if rows.is_empty() => println!("(empty)"),
333        Ok(rows) => {
334            for row in rows {
335                println!("{}  {:?}", row.ts.to_rfc3339(), row.event);
336            }
337        }
338        Err(e) => println!("(audit read: {e})"),
339    }
340
341    if actions_path.exists() {
342        let body = fs::read_to_string(&actions_path).unwrap_or_default();
343        println!("\n── actions.log ({} lines) ──", body.lines().count());
344        for line in body
345            .lines()
346            .rev()
347            .take(5)
348            .collect::<Vec<_>>()
349            .into_iter()
350            .rev()
351        {
352            println!("{line}");
353        }
354    }
355
356    println!("\n── takeaway ──");
357    println!("1. EventInbox + EventQueueObserver  = observe plugin");
358    println!("2. PolicyGateExecutor              = execute plugin (log-only gate)");
359    println!("3. Kernel::with_adapters           = core loop unchanged");
360    println!("4. audit.jsonl + actions.log       = operator evidence");
361    if keep {
362        println!("\nKEEP_INBOX=1 → workspace kept at {}", root.display());
363    } else {
364        let _ = fs::remove_dir_all(&root);
365        println!("\n(temp workspace removed; set KEEP_INBOX=1 to inspect files)");
366    }
367    Ok(())
368}
Source

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

Examples found in repository?
examples/config_and_dir.rs (line 28)
10fn main() -> Result<()> {
11    let work = temp_dir().join(format!(
12        "omega-phase1-{}",
13        omega_cognitive_kernel::new_uuid()
14    ));
15    std::fs::create_dir_all(&work).expect("mkdir");
16    std::fs::write(work.join("signal.txt"), b"load=0.4").expect("write signal");
17
18    let cfg_path = work.join("omega.toml");
19    let state_path = work.join("state.json");
20    let cfg = KernelConfig {
21        state_path: Some(state_path.display().to_string()),
22        autosave: false,
23        auto_checkpoint_on_patch: false,
24        max_risk: 0.5,
25        error_threshold: 0.28,
26        ..KernelConfig::default()
27    };
28    cfg.save(&cfg_path)?;
29
30    println!("config: {}", cfg_path.display());
31    println!("watching dir: {}", work.display());
32
33    let observer = DirSnapshotObserver::new(&work).max_entries(32);
34    let executor = LoggingExecutor::new([
35        "noop".into(),
36        "observe".into(),
37        "explore".into(),
38        "exploit".into(),
39        "stabilize".into(),
40    ])
41    .echo_stdout(true);
42
43    let mut kernel = Kernel::with_adapters_and_path(observer, executor, &state_path);
44    kernel.apply_config(&KernelConfig::load(&cfg_path)?);
45
46    let report = kernel.run("monitor drop directory and stabilize under uncertainty", 4)?;
47    println!(
48        "\nsteps={} err {:.3}→{:.3} decreased={} actions={:?}",
49        report.steps,
50        report.early_avg_err,
51        report.final_avg_err,
52        report.error_decreased,
53        report.last_actions
54    );
55    println!("max_risk now {}", kernel.status().max_risk);
56
57    let _ = std::fs::remove_dir_all(&work);
58    Ok(())
59}
More examples
Hide additional examples
examples/drop_inbox_loop.rs (line 41)
19fn main() -> Result<()> {
20    let root = temp_dir().join(format!(
21        "omega-inbox-{}",
22        omega_cognitive_kernel::new_uuid()
23    ));
24    let inbox = root.join("inbox");
25    let cfg_path = root.join("omega.toml");
26    let state_path = root.join("state.json");
27    let action_log = root.join("actions.log");
28
29    fs::create_dir_all(&inbox).expect("mkdir inbox");
30
31    let cfg = KernelConfig {
32        state_path: Some(state_path.display().to_string()),
33        autosave: true,
34        auto_checkpoint_on_patch: true,
35        error_threshold: 0.28,
36        min_steps_between_patches: 2,
37        max_risk: 0.55,
38        default_goal: Some("stabilize under inbox load and keep audit trail".into()),
39        ..KernelConfig::default()
40    };
41    cfg.save(&cfg_path)?;
42
43    println!("=== Omega drop-inbox loop ===");
44    println!("root   : {}", root.display());
45    println!("inbox  : {}", inbox.display());
46    println!("config : {}", cfg_path.display());
47    println!("actions: {}", action_log.display());
48    println!();
49
50    // Seed a few "arrivals" so the first observations are non-empty.
51    fs::write(inbox.join("job-001.txt"), b"priority=low").ok();
52
53    let observer = DirSnapshotObserver::new(&inbox).max_entries(128);
54    let executor = LoggingExecutor::new([
55        "noop".into(),
56        "observe".into(),
57        "explore".into(),
58        "exploit".into(),
59        "stabilize".into(),
60    ])
61    .with_log_file(&action_log)
62    .echo_stdout(true);
63
64    let mut kernel = Kernel::with_adapters_and_path(observer, executor, &state_path);
65    kernel.apply_config(&KernelConfig::load(&cfg_path)?);
66
67    let goal = cfg
68        .default_goal
69        .clone()
70        .unwrap_or_else(|| "stabilize under inbox load".into());
71
72    // Simulate an external producer while the kernel runs.
73    for step in 1..=8u32 {
74        // "World" side: more files → more load signal in dir snapshot.
75        if step % 2 == 0 {
76            let name = format!("job-{:03}.txt", step + 10);
77            let body = format!("priority=high step={step}");
78            let _ = fs::write(inbox.join(name), body);
79            println!("[world] dropped file into inbox (step {step})");
80        }
81
82        let r = kernel.step(&goal)?;
83        let act = r
84            .trajectory
85            .actions
86            .first()
87            .map(|a| a.name.as_str())
88            .unwrap_or("-");
89        let st = kernel.status();
90        println!(
91            "[kernel] step={step} act={act:<9} patched={} avg_err={:.3} damp={:.2} max_risk={:.2}",
92            r.l1.patched, st.avg_prediction_error, st.error_damping, st.max_risk
93        );
94
95        thread::sleep(Duration::from_millis(30));
96    }
97
98    kernel.save()?;
99
100    println!("\n── summary ──");
101    let st = kernel.status();
102    println!(
103        "steps={}  avg_err={:.3}  modules={}  ckpts={}",
104        st.total_steps, st.avg_prediction_error, st.active_modules, st.checkpoint_count
105    );
106    if action_log.exists() {
107        let log = fs::read_to_string(&action_log).unwrap_or_default();
108        let lines = log.lines().count();
109        println!("action log lines: {lines}  ({})", action_log.display());
110    }
111    println!("\nCleanup: remove {}", root.display());
112    let _ = fs::remove_dir_all(&root);
113    Ok(())
114}
examples/inbox_vertical.rs (line 247)
217fn main() -> Result<()> {
218    let keep = env::var("KEEP_INBOX").ok().as_deref() == Some("1");
219    let root = if keep {
220        PathBuf::from("./omega-inbox-demo")
221    } else {
222        env::temp_dir().join(format!(
223            "omega-inbox-demo-{}",
224            omega_cognitive_kernel::new_uuid()
225        ))
226    };
227    let _ = fs::remove_dir_all(&root);
228    fs::create_dir_all(&root).expect("mkdir");
229
230    let state_path = root.join("state.json");
231    let cfg_path = root.join("omega.toml");
232    let actions_path = root.join("actions.log");
233
234    // Tight cooldown so the demo is likely to show at least one patch under load.
235    let cfg = KernelConfig {
236        state_path: Some(state_path.display().to_string()),
237        autosave: true,
238        auto_checkpoint_on_patch: true,
239        error_threshold: 0.25,
240        min_steps_between_patches: 2,
241        max_risk: 0.50,
242        default_goal: Some(
243            "drain inbox under rising load; prefer stabilize when pressure high".into(),
244        ),
245        ..KernelConfig::default()
246    };
247    cfg.save(&cfg_path)?;
248
249    println!("╔══════════════════════════════════════════════════╗");
250    println!("║  Omega Inbox Vertical — pluggable observe/act    ║");
251    println!("╚══════════════════════════════════════════════════╝");
252    println!("workspace : {}", root.display());
253    println!("config    : {}", cfg_path.display());
254    println!("state     : {}", state_path.display());
255    println!("actions   : {}", actions_path.display());
256    println!("audit     : beside state (audit.jsonl)");
257    println!();
258
259    let inbox = EventInbox::default();
260
261    // ── Mount plugins (this is the whole integration surface) ───────────────
262    let observer = EventQueueObserver::new(inbox.clone());
263    let executor = PolicyGateExecutor::new(whitelist(), &actions_path);
264    let mut kernel = Kernel::with_adapters_and_path(observer, executor, &state_path);
265    kernel.apply_config(&KernelConfig::load(&cfg_path)?);
266
267    let goal = cfg.default_goal.clone().unwrap();
268
269    // Scripted "external producer" stream of text/events.
270    let script: &[(&str, &str, u8)] = &[
271        ("e1", "user signup from region=us-east", 1),
272        ("e2", "batch job: reindex catalog", 2),
273        ("e3", "ALERT: queue lag 2.1s", 5),
274        ("e4", "ALERT: error rate spike 4%", 5),
275        ("e5", "deploy canary 10%", 3),
276        ("e6", "ALERT: disk pressure 92%", 5),
277        ("e7", "customer ticket #4412 escalated", 4),
278        ("e8", "nightly backup complete", 1),
279        ("e9", "ALERT: p99 latency 1.8s", 5),
280        ("e10", "scale-out request from autoscaler", 3),
281    ];
282
283    println!("── live stream ──");
284    for (i, (id, text, pri)) in script.iter().enumerate() {
285        let step = (i + 1) as u32;
286        inbox.push(*id, *text, *pri);
287        println!(
288            "[world] +{id} pri={pri} depth={}  «{}»",
289            inbox.len(),
290            truncate(text, 40)
291        );
292
293        let r = kernel.step(&goal)?;
294        let act = r
295            .trajectory
296            .actions
297            .first()
298            .map(|a| a.name.as_str())
299            .unwrap_or("-");
300        let st = kernel.status();
301        print!(
302            "[kernel] step={step:<2} act={act:<9} patched={:<5} err={:.3} damp={:.2}",
303            r.l1.patched, st.avg_prediction_error, st.error_damping
304        );
305        if r.l1.patched {
306            print!("  ★ RuleEffect committed");
307        }
308        println!();
309    }
310
311    kernel.save()?;
312
313    // ── Evidence operators care about ───────────────────────────────────────
314    println!("\n── status ──");
315    let st = kernel.status();
316    println!(
317        "steps={}  avg_err={:.3}  damp={:.3}  explore={:.3}  risk_tol={:.3}  max_risk={:.2}",
318        st.total_steps,
319        st.avg_prediction_error,
320        st.error_damping,
321        st.explore_bonus,
322        st.risk_tolerance,
323        st.max_risk
324    );
325    println!(
326        "modules={}  checkpoints={}  L2 in_fp={} align={:.3}",
327        st.active_modules, st.checkpoint_count, st.in_fixed_point, st.last_alignment_score
328    );
329
330    println!("\n── audit.jsonl (tail) ──");
331    match kernel.audit_tail(12) {
332        Ok(rows) if rows.is_empty() => println!("(empty)"),
333        Ok(rows) => {
334            for row in rows {
335                println!("{}  {:?}", row.ts.to_rfc3339(), row.event);
336            }
337        }
338        Err(e) => println!("(audit read: {e})"),
339    }
340
341    if actions_path.exists() {
342        let body = fs::read_to_string(&actions_path).unwrap_or_default();
343        println!("\n── actions.log ({} lines) ──", body.lines().count());
344        for line in body
345            .lines()
346            .rev()
347            .take(5)
348            .collect::<Vec<_>>()
349            .into_iter()
350            .rev()
351        {
352            println!("{line}");
353        }
354    }
355
356    println!("\n── takeaway ──");
357    println!("1. EventInbox + EventQueueObserver  = observe plugin");
358    println!("2. PolicyGateExecutor              = execute plugin (log-only gate)");
359    println!("3. Kernel::with_adapters           = core loop unchanged");
360    println!("4. audit.jsonl + actions.log       = operator evidence");
361    if keep {
362        println!("\nKEEP_INBOX=1 → workspace kept at {}", root.display());
363    } else {
364        let _ = fs::remove_dir_all(&root);
365        println!("\n(temp workspace removed; set KEEP_INBOX=1 to inspect files)");
366    }
367    Ok(())
368}
Source

pub fn resolved_state_path(&self) -> PathBuf

Trait Implementations§

Source§

impl Clone for KernelConfig

Source§

fn clone(&self) -> Self

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 KernelConfig

Source§

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

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

impl Default for KernelConfig

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for KernelConfig

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 Serialize for KernelConfig

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

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<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<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<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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