Skip to main content

Memory

Struct Memory 

Source
pub struct Memory { /* private fields */ }
Expand description

Mémoire d’un agent : moteur de stockage (vecteur natif) + embedder, scellés par un AgentId. Le chiffrement est obligatoire (ADR-007).

Implementations§

Source§

impl Memory

Source

pub async fn export_jsonl(&self) -> Result<String>

Exporte tout ce qui appartient à cet agent — souvenirs (y compris invalidés/expirés : c’est un backup, la validité est préservée), entités et relations du graphe — en JSONL versionné.

Les embeddings sont volontairement exclus (re-calculables) : le fichier est portable entre machines et entre modèles d’embedding.

§Errors

Propage les erreurs de stockage/sérialisation.

Source

pub async fn import_jsonl(&self, jsonl: &str) -> Result<ImportReport>

Importe un export JSONL dans cette mémoire (l’agent cible est celui de la façade, quel que soit l’agent_id d’origine de l’export).

Les souvenirs sont ré-embeddés par l’embedder courant (une passe embed_batch par lots de 128), puis tout est inséré dans une seule transaction : l’import aboutit entièrement ou pas du tout. Idempotent : les lignes dont l’identifiant existe déjà sont comptées en *_skipped et laissées intactes.

§Errors

MemoryError::Porting si l’en-tête manque/diverge ou si une ligne est malformée ; MemoryError::UnknownLayer si une couche est inconnue ; propage les erreurs d’embedding/stockage.

Source§

impl Memory

Source

pub fn new(store: Store, embedder: Box<dyn Embedder>, agent: AgentId) -> Self

Assemble une mémoire à partir des primitives du core déjà construites, sans migrer le schéma (à utiliser quand le schéma est déjà en place).

Source

pub async fn open( store: Store, embedder: Box<dyn Embedder>, agent: AgentId, ) -> Result<Self>

Ouvre une mémoire : vérifie le chiffrement, applique le schéma (memory + index vecteur natif), puis renvoie la façade scellée par agent.

Le chiffrement est obligatoire pour les stores sur fichier (ADR-007) : un store :memory: est éphémère, la règle ne s’y applique pas.

§Errors

crate::MemoryError::EncryptionRequired si le store est sur fichier et non chiffré. crate::MemoryError::Core si la migration échoue.

Examples found in repository?
examples/llm_consolidation.rs (line 55)
52async fn main() -> Result<(), Box<dyn std::error::Error>> {
53    let store = Store::open_in_memory().await?;
54    let agent = AgentId::new("consolidation-demo").expect("non-empty id");
55    let memory = Memory::open(store, Box::new(FakeEmbedder), agent).await?;
56
57    // Store a raw episode (what happened).
58    memory
59        .remember(
60            "Alice attended a conference in Paris, the capital of France.",
61            MemoryLayer::Episodic,
62        )
63        .await?;
64
65    // Consolidate: extract facts + populate graph via FakeLlm.
66    let report = consolidate(&memory, &FakeLlm).await?;
67    println!(
68        "Consolidation: {} episode(s) seen, {} fact(s) added, {} entity(ies) upserted, {} relation(s).",
69        report.episodes_seen, report.facts_added, report.entities_upserted, report.relations_upserted,
70    );
71
72    // The extracted fact should now be searchable in semantic layer.
73    let facts = memory
74        .recall_by_layer("What is the capital of France?", MemoryLayer::Semantic, 5)
75        .await?;
76    println!("\nSemantic facts after consolidation ({}):", facts.len());
77    for f in &facts {
78        println!("  • {}", f.text);
79    }
80
81    Ok(())
82}
More examples
Hide additional examples
examples/temporal_replacement.rs (line 46)
43async fn main() -> Result<(), Box<dyn std::error::Error>> {
44    let store = Store::open_in_memory().await?;
45    let agent = AgentId::new("temporal-demo").expect("non-empty id");
46    let memory = Memory::open(store, Box::new(DemoEmbedder), agent).await?;
47
48    let old_id = memory
49        .remember("The user is on the Free billing plan.", MemoryLayer::Semantic)
50        .await?;
51
52    println!("Initially remembered: Free plan ({old_id})");
53
54    memory.invalidate(&old_id).await?;
55    let new_id = memory
56        .remember("The user is on the Pro billing plan.", MemoryLayer::Semantic)
57        .await?;
58
59    println!("Invalidated old fact and remembered: Pro plan ({new_id})");
60
61    let hits = memory.recall_hybrid("current billing plan", 5).await?;
62    println!("\nRecall for `current billing plan`:");
63    for hit in &hits {
64        println!("  [{layer}] {text}", layer = hit.layer.table(), text = hit.text);
65    }
66
67    assert!(
68        hits.iter().any(|r| r.text.contains("Pro billing plan")),
69        "the current fact should be recalled"
70    );
71    assert!(
72        hits.iter().all(|r| !r.text.contains("Free billing plan")),
73        "the invalidated fact should not be recalled"
74    );
75
76    Ok(())
77}
examples/memory_basic.rs (line 32)
29async fn main() -> Result<(), Box<dyn std::error::Error>> {
30    let store = Store::open_in_memory().await?;
31    let agent = AgentId::new("demo-agent").expect("non-empty id");
32    let memory = Memory::open(store, Box::new(FakeEmbedder), agent).await?;
33
34    memory
35        .remember("The Eiffel Tower is in Paris.", MemoryLayer::Semantic)
36        .await?;
37    memory
38        .remember("Paris is the capital of France.", MemoryLayer::Semantic)
39        .await?;
40    memory.remember("Bonjour!", MemoryLayer::ShortTerm).await?;
41
42    println!("=== recall (top 2) ===");
43    let results = memory.recall("What city is the Eiffel Tower in?", 2).await?;
44    for r in &results {
45        println!(
46            "  [{layer}] {score:.3}  {text}",
47            layer = r.layer.table(),
48            score = r.score,
49            text = r.text
50        );
51    }
52
53    let first_id = results[0].id.clone();
54    memory.invalidate(&first_id).await?;
55    println!("\nInvalidated id={first_id}");
56
57    let after = memory.recall("Eiffel Tower", 5).await?;
58    println!("Recall after invalidation: {} result(s)", after.len());
59
60    let stats = memory.stats().await?;
61    println!(
62        "\nStats: {} semantic, {} short-term (valid).",
63        stats.semantic, stats.short_term
64    );
65
66    Ok(())
67}
Source

pub fn agent(&self) -> &AgentId

L’agent propriétaire de cette mémoire.

Source

pub fn watch( &self, agent_id: &str, layer: Option<MemoryLayer>, ) -> MemorySubscription

S’abonne au flux d’événements mémoire de cet agent (et d’une couche donnée, si layer est fourni). L’abonnement renvoyé n’expose jamais le canal brut : l’isolation par agent/couche est appliquée côté serveur dans MemorySubscription::recv, jamais déléguée à l’appelant.

agent_id est capturé tel quel : un appelant qui passe l’identifiant d’un autre agent ne reçoit que les événements de cet autre agent — il ne peut pas remonter au-delà de ce que Memory émet, et chaque Memory n’émet que pour son propre agent. La sécurité multi-tenant repose sur l’isolation SQL en amont (ADR-006) ; ce filtre la prolonge au flux.

Source

pub fn graph(&self) -> Graph

Façade graphe sur le même moteur, scellée par le même agent.

Permet aux consommateurs externes (MCP, REST, bindings) de traverser le graphe entités/relations (recall_graph) sans accéder au moteur, tout en conservant l’isolation par agent au niveau SQL (ADR-006).

Source

pub async fn remember(&self, text: &str, layer: MemoryLayer) -> Result<String>

Mémorise un texte dans une couche, valide dès maintenant et sans expiration. Renvoie l’identifiant (UUID v4) du souvenir créé.

§Errors

Propage les erreurs d’embedding/stockage.

Examples found in repository?
examples/llm_consolidation.rs (lines 59-62)
52async fn main() -> Result<(), Box<dyn std::error::Error>> {
53    let store = Store::open_in_memory().await?;
54    let agent = AgentId::new("consolidation-demo").expect("non-empty id");
55    let memory = Memory::open(store, Box::new(FakeEmbedder), agent).await?;
56
57    // Store a raw episode (what happened).
58    memory
59        .remember(
60            "Alice attended a conference in Paris, the capital of France.",
61            MemoryLayer::Episodic,
62        )
63        .await?;
64
65    // Consolidate: extract facts + populate graph via FakeLlm.
66    let report = consolidate(&memory, &FakeLlm).await?;
67    println!(
68        "Consolidation: {} episode(s) seen, {} fact(s) added, {} entity(ies) upserted, {} relation(s).",
69        report.episodes_seen, report.facts_added, report.entities_upserted, report.relations_upserted,
70    );
71
72    // The extracted fact should now be searchable in semantic layer.
73    let facts = memory
74        .recall_by_layer("What is the capital of France?", MemoryLayer::Semantic, 5)
75        .await?;
76    println!("\nSemantic facts after consolidation ({}):", facts.len());
77    for f in &facts {
78        println!("  • {}", f.text);
79    }
80
81    Ok(())
82}
More examples
Hide additional examples
examples/temporal_replacement.rs (line 49)
43async fn main() -> Result<(), Box<dyn std::error::Error>> {
44    let store = Store::open_in_memory().await?;
45    let agent = AgentId::new("temporal-demo").expect("non-empty id");
46    let memory = Memory::open(store, Box::new(DemoEmbedder), agent).await?;
47
48    let old_id = memory
49        .remember("The user is on the Free billing plan.", MemoryLayer::Semantic)
50        .await?;
51
52    println!("Initially remembered: Free plan ({old_id})");
53
54    memory.invalidate(&old_id).await?;
55    let new_id = memory
56        .remember("The user is on the Pro billing plan.", MemoryLayer::Semantic)
57        .await?;
58
59    println!("Invalidated old fact and remembered: Pro plan ({new_id})");
60
61    let hits = memory.recall_hybrid("current billing plan", 5).await?;
62    println!("\nRecall for `current billing plan`:");
63    for hit in &hits {
64        println!("  [{layer}] {text}", layer = hit.layer.table(), text = hit.text);
65    }
66
67    assert!(
68        hits.iter().any(|r| r.text.contains("Pro billing plan")),
69        "the current fact should be recalled"
70    );
71    assert!(
72        hits.iter().all(|r| !r.text.contains("Free billing plan")),
73        "the invalidated fact should not be recalled"
74    );
75
76    Ok(())
77}
examples/memory_basic.rs (line 35)
29async fn main() -> Result<(), Box<dyn std::error::Error>> {
30    let store = Store::open_in_memory().await?;
31    let agent = AgentId::new("demo-agent").expect("non-empty id");
32    let memory = Memory::open(store, Box::new(FakeEmbedder), agent).await?;
33
34    memory
35        .remember("The Eiffel Tower is in Paris.", MemoryLayer::Semantic)
36        .await?;
37    memory
38        .remember("Paris is the capital of France.", MemoryLayer::Semantic)
39        .await?;
40    memory.remember("Bonjour!", MemoryLayer::ShortTerm).await?;
41
42    println!("=== recall (top 2) ===");
43    let results = memory.recall("What city is the Eiffel Tower in?", 2).await?;
44    for r in &results {
45        println!(
46            "  [{layer}] {score:.3}  {text}",
47            layer = r.layer.table(),
48            score = r.score,
49            text = r.text
50        );
51    }
52
53    let first_id = results[0].id.clone();
54    memory.invalidate(&first_id).await?;
55    println!("\nInvalidated id={first_id}");
56
57    let after = memory.recall("Eiffel Tower", 5).await?;
58    println!("Recall after invalidation: {} result(s)", after.len());
59
60    let stats = memory.stats().await?;
61    println!(
62        "\nStats: {} semantic, {} short-term (valid).",
63        stats.semantic, stats.short_term
64    );
65
66    Ok(())
67}
Source

pub async fn remember_with( &self, text: &str, layer: MemoryLayer, validity: Validity, ) -> Result<String>

Mémorise un texte avec une fenêtre de validité explicite. Renvoie l’identifiant (UUID v4) du souvenir créé — les consommateurs (MCP, REST, bindings) le retournent à l’appelant pour invalidation/effacement ultérieurs.

L’insertion memory + miroir FTS est atomique (Store::begin_write) : jamais de souvenir visible par vecteur mais invisible en BM25, ou l’inverse.

§Errors

MemoryError::TextTooLong si text dépasse MAX_TEXT_LEN. Propage aussi les erreurs d’embedding/stockage.

Source

pub async fn remember_batch( &self, texts: &[String], layer: MemoryLayer, ) -> Result<Vec<String>>

Mémorise un lot de textes dans une couche, valides dès maintenant et sans expiration. Renvoie les identifiants créés, dans l’ordre des textes.

§Errors

Propage les erreurs d’embedding/stockage.

Source

pub async fn remember_batch_with( &self, texts: &[String], layer: MemoryLayer, validity: Validity, ) -> Result<Vec<String>>

Mémorise un lot avec une fenêtre de validité explicite : une passe d’embedding (Embedder::embed_batch) et une transaction — le lot devient visible d’un coup, ou pas du tout. C’est le chemin de l’ingestion initiale (import d’historique, seed de connaissances).

§Errors

MemoryError::TextTooLong si un texte du lot dépasse MAX_TEXT_LEN (fail-fast : le premier texte trop long stoppe le lot, rien n’est inséré puisque la validation précède l’embedding/la transaction). Propage aussi les erreurs d’embedding/stockage.

Source

pub async fn recall(&self, query: &str, k: usize) -> Result<Vec<Record>>

Recall temporel : pertinent ET valide, borné à cet agent.

L’isolation (agent_id) et le filtre temporel sont appliqués par le moteur de stockage (MemoryStore::recall_vector) — Memory ne connaît plus le SQL, seulement le vecteur de requête et l’agent.

§Errors

Propage les erreurs d’embedding/recherche.

Examples found in repository?
examples/memory_basic.rs (line 43)
29async fn main() -> Result<(), Box<dyn std::error::Error>> {
30    let store = Store::open_in_memory().await?;
31    let agent = AgentId::new("demo-agent").expect("non-empty id");
32    let memory = Memory::open(store, Box::new(FakeEmbedder), agent).await?;
33
34    memory
35        .remember("The Eiffel Tower is in Paris.", MemoryLayer::Semantic)
36        .await?;
37    memory
38        .remember("Paris is the capital of France.", MemoryLayer::Semantic)
39        .await?;
40    memory.remember("Bonjour!", MemoryLayer::ShortTerm).await?;
41
42    println!("=== recall (top 2) ===");
43    let results = memory.recall("What city is the Eiffel Tower in?", 2).await?;
44    for r in &results {
45        println!(
46            "  [{layer}] {score:.3}  {text}",
47            layer = r.layer.table(),
48            score = r.score,
49            text = r.text
50        );
51    }
52
53    let first_id = results[0].id.clone();
54    memory.invalidate(&first_id).await?;
55    println!("\nInvalidated id={first_id}");
56
57    let after = memory.recall("Eiffel Tower", 5).await?;
58    println!("Recall after invalidation: {} result(s)", after.len());
59
60    let stats = memory.stats().await?;
61    println!(
62        "\nStats: {} semantic, {} short-term (valid).",
63        stats.semantic, stats.short_term
64    );
65
66    Ok(())
67}
Source

pub async fn recall_with_metric( &self, query: &str, k: usize, metric: Metric, ) -> Result<Vec<Record>>

Recall sémantique temporel avec métrique explicite (Metric).

Metric::Cosine emprunte le chemin natif ; Metric::Euclidean et Metric::Hamming sur-échantillonnent les candidats cosinus puis sont re-classées en Rust (ADR-012). Met à jour last_access sur les résultats.

§Errors

Propage les erreurs d’embedding/recherche.

Source

pub async fn recall_hybrid(&self, query: &str, k: usize) -> Result<Vec<Record>>

Recall hybride (ADR-014) : fusionne le classement vectoriel et le classement BM25 (full-text natif libSQL) par Reciprocal Rank Fusion (rrf_fuse). Un terme exact que l’embedding rate (sigle, identifiant rare, nom propre) remonte par BM25 ; une reformulation que les mots-clés ratent remonte par le vecteur. Borné à l’agent et à la validité. Met à jour last_access sur les résultats.

Le score du Record retourné porte le score RRF fusionné, pas la similarité cosinus.

§Errors

Propage les erreurs d’embedding/recherche/stockage.

Examples found in repository?
examples/temporal_replacement.rs (line 61)
43async fn main() -> Result<(), Box<dyn std::error::Error>> {
44    let store = Store::open_in_memory().await?;
45    let agent = AgentId::new("temporal-demo").expect("non-empty id");
46    let memory = Memory::open(store, Box::new(DemoEmbedder), agent).await?;
47
48    let old_id = memory
49        .remember("The user is on the Free billing plan.", MemoryLayer::Semantic)
50        .await?;
51
52    println!("Initially remembered: Free plan ({old_id})");
53
54    memory.invalidate(&old_id).await?;
55    let new_id = memory
56        .remember("The user is on the Pro billing plan.", MemoryLayer::Semantic)
57        .await?;
58
59    println!("Invalidated old fact and remembered: Pro plan ({new_id})");
60
61    let hits = memory.recall_hybrid("current billing plan", 5).await?;
62    println!("\nRecall for `current billing plan`:");
63    for hit in &hits {
64        println!("  [{layer}] {text}", layer = hit.layer.table(), text = hit.text);
65    }
66
67    assert!(
68        hits.iter().any(|r| r.text.contains("Pro billing plan")),
69        "the current fact should be recalled"
70    );
71    assert!(
72        hits.iter().all(|r| !r.text.contains("Free billing plan")),
73        "the invalidated fact should not be recalled"
74    );
75
76    Ok(())
77}
Source

pub async fn recall_by_layer( &self, query: &str, layer: MemoryLayer, k: usize, ) -> Result<Vec<Record>>

Recall filtré sur une couche unique. Met à jour last_access sur chaque souvenir retourné (l’oubli adaptatif en dépend).

§Errors

Propage les erreurs d’embedding/recherche.

Examples found in repository?
examples/llm_consolidation.rs (line 74)
52async fn main() -> Result<(), Box<dyn std::error::Error>> {
53    let store = Store::open_in_memory().await?;
54    let agent = AgentId::new("consolidation-demo").expect("non-empty id");
55    let memory = Memory::open(store, Box::new(FakeEmbedder), agent).await?;
56
57    // Store a raw episode (what happened).
58    memory
59        .remember(
60            "Alice attended a conference in Paris, the capital of France.",
61            MemoryLayer::Episodic,
62        )
63        .await?;
64
65    // Consolidate: extract facts + populate graph via FakeLlm.
66    let report = consolidate(&memory, &FakeLlm).await?;
67    println!(
68        "Consolidation: {} episode(s) seen, {} fact(s) added, {} entity(ies) upserted, {} relation(s).",
69        report.episodes_seen, report.facts_added, report.entities_upserted, report.relations_upserted,
70    );
71
72    // The extracted fact should now be searchable in semantic layer.
73    let facts = memory
74        .recall_by_layer("What is the capital of France?", MemoryLayer::Semantic, 5)
75        .await?;
76    println!("\nSemantic facts after consolidation ({}):", facts.len());
77    for f in &facts {
78        println!("  • {}", f.text);
79    }
80
81    Ok(())
82}
Source

pub async fn invalidate(&self, id: &str) -> Result<()>

Invalide un souvenir en fixant valid_until = now(). Il n’apparaît plus dans les recalls futurs mais reste physiquement en base.

§Errors

Propage les erreurs de stockage.

Examples found in repository?
examples/temporal_replacement.rs (line 54)
43async fn main() -> Result<(), Box<dyn std::error::Error>> {
44    let store = Store::open_in_memory().await?;
45    let agent = AgentId::new("temporal-demo").expect("non-empty id");
46    let memory = Memory::open(store, Box::new(DemoEmbedder), agent).await?;
47
48    let old_id = memory
49        .remember("The user is on the Free billing plan.", MemoryLayer::Semantic)
50        .await?;
51
52    println!("Initially remembered: Free plan ({old_id})");
53
54    memory.invalidate(&old_id).await?;
55    let new_id = memory
56        .remember("The user is on the Pro billing plan.", MemoryLayer::Semantic)
57        .await?;
58
59    println!("Invalidated old fact and remembered: Pro plan ({new_id})");
60
61    let hits = memory.recall_hybrid("current billing plan", 5).await?;
62    println!("\nRecall for `current billing plan`:");
63    for hit in &hits {
64        println!("  [{layer}] {text}", layer = hit.layer.table(), text = hit.text);
65    }
66
67    assert!(
68        hits.iter().any(|r| r.text.contains("Pro billing plan")),
69        "the current fact should be recalled"
70    );
71    assert!(
72        hits.iter().all(|r| !r.text.contains("Free billing plan")),
73        "the invalidated fact should not be recalled"
74    );
75
76    Ok(())
77}
More examples
Hide additional examples
examples/memory_basic.rs (line 54)
29async fn main() -> Result<(), Box<dyn std::error::Error>> {
30    let store = Store::open_in_memory().await?;
31    let agent = AgentId::new("demo-agent").expect("non-empty id");
32    let memory = Memory::open(store, Box::new(FakeEmbedder), agent).await?;
33
34    memory
35        .remember("The Eiffel Tower is in Paris.", MemoryLayer::Semantic)
36        .await?;
37    memory
38        .remember("Paris is the capital of France.", MemoryLayer::Semantic)
39        .await?;
40    memory.remember("Bonjour!", MemoryLayer::ShortTerm).await?;
41
42    println!("=== recall (top 2) ===");
43    let results = memory.recall("What city is the Eiffel Tower in?", 2).await?;
44    for r in &results {
45        println!(
46            "  [{layer}] {score:.3}  {text}",
47            layer = r.layer.table(),
48            score = r.score,
49            text = r.text
50        );
51    }
52
53    let first_id = results[0].id.clone();
54    memory.invalidate(&first_id).await?;
55    println!("\nInvalidated id={first_id}");
56
57    let after = memory.recall("Eiffel Tower", 5).await?;
58    println!("Recall after invalidation: {} result(s)", after.len());
59
60    let stats = memory.stats().await?;
61    println!(
62        "\nStats: {} semantic, {} short-term (valid).",
63        stats.semantic, stats.short_term
64    );
65
66    Ok(())
67}
Source

pub async fn forget(&self, id: &str) -> Result<()>

Suppression physique d’un souvenir (RGPD, droit à l’effacement). Atomique : la ligne memory et son miroir FTS disparaissent ensemble.

§Errors

Propage les erreurs de stockage.

Source

pub async fn purge_agent(&self) -> Result<()>

Purge toutes les données de cet agent : souvenirs (memory), entités (entity) et relations (edge). Irréversible (RGPD, droit à l’oubli). Idempotent : ne renvoie pas d’erreur si l’agent n’a aucune donnée. Atomique : pas de purge partielle possible (tout ou rien).

§Errors

Propage les erreurs de stockage.

Source

pub async fn stats(&self) -> Result<AgentStats>

Statistiques des souvenirs valides de cet agent, par couche.

§Errors

Propage les erreurs de stockage.

Examples found in repository?
examples/memory_basic.rs (line 60)
29async fn main() -> Result<(), Box<dyn std::error::Error>> {
30    let store = Store::open_in_memory().await?;
31    let agent = AgentId::new("demo-agent").expect("non-empty id");
32    let memory = Memory::open(store, Box::new(FakeEmbedder), agent).await?;
33
34    memory
35        .remember("The Eiffel Tower is in Paris.", MemoryLayer::Semantic)
36        .await?;
37    memory
38        .remember("Paris is the capital of France.", MemoryLayer::Semantic)
39        .await?;
40    memory.remember("Bonjour!", MemoryLayer::ShortTerm).await?;
41
42    println!("=== recall (top 2) ===");
43    let results = memory.recall("What city is the Eiffel Tower in?", 2).await?;
44    for r in &results {
45        println!(
46            "  [{layer}] {score:.3}  {text}",
47            layer = r.layer.table(),
48            score = r.score,
49            text = r.text
50        );
51    }
52
53    let first_id = results[0].id.clone();
54    memory.invalidate(&first_id).await?;
55    println!("\nInvalidated id={first_id}");
56
57    let after = memory.recall("Eiffel Tower", 5).await?;
58    println!("Recall after invalidation: {} result(s)", after.len());
59
60    let stats = memory.stats().await?;
61    println!(
62        "\nStats: {} semantic, {} short-term (valid).",
63        stats.semantic, stats.short_term
64    );
65
66    Ok(())
67}
Source

pub async fn search_graph(&self, query: &str, k: usize) -> Result<Vec<Record>>

Recall vectoriel limité aux souvenirs dont le contenu mentionne une entité du graphe (P2). Met à jour last_access sur les résultats.

§Errors

Propage les erreurs d’embedding/recherche.

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

Source§

type Output = T

Should always be Self
Source§

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

Source§

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

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