Skip to main content

Identifiable

Trait Identifiable 

Source
pub trait Identifiable {
    // Required method
    fn id(&self) -> &str;
}
Expand description

Identifiable component or child.

All entities in ORCS must be identifiable for:

  • Routing: Directing messages to the right target
  • Logging: Attributing actions to actors
  • Debugging: Tracing execution flow

§ID Format

IDs should be:

  • Unique within their scope (e.g., within a manager)
  • Human-readable for debugging
  • Stable across restarts (for serialized entities)

§Example

use orcs_component::Identifiable;

struct Task {
    id: String,
    description: String,
}

impl Identifiable for Task {
    fn id(&self) -> &str {
        &self.id
    }
}

let task = Task {
    id: "task-001".into(),
    description: "Process files".into(),
};
assert_eq!(task.id(), "task-001");

Required Methods§

Source

fn id(&self) -> &str

Returns the entity’s identifier.

This should be stable and unique within scope.

Implementors§