pub trait ChannelCore {
Show 16 methods
// Required methods
fn id(&self) -> ChannelId;
fn principal(&self) -> &Principal;
fn state(&self) -> &ChannelState;
fn config(&self) -> &ChannelConfig;
fn parent(&self) -> Option<ChannelId>;
fn children(&self) -> &HashSet<ChannelId>;
fn ancestor_path(&self) -> &[ChannelId];
// Provided methods
fn is_running(&self) -> bool { ... }
fn is_paused(&self) -> bool { ... }
fn is_awaiting_approval(&self) -> bool { ... }
fn is_terminal(&self) -> bool { ... }
fn priority(&self) -> u8 { ... }
fn can_spawn(&self) -> bool { ... }
fn has_children(&self) -> bool { ... }
fn depth(&self) -> usize { ... }
fn is_descendant_of(&self, ancestor: ChannelId) -> bool { ... }
}Expand description
Core channel interface.
This trait defines the essential operations that all channel types must support. It provides a common interface for state queries, tree navigation, and lifecycle management.
§Implementors
BaseChannel: Basic channel with state and tree management
For Human-interactive channels, use ClientRunner which
owns a BaseChannel internally.
§Example
use orcs_runtime::channel::ChannelCore;
fn process_channel(channel: &impl ChannelCore) {
println!("Channel {} is running: {}", channel.id(), channel.is_running());
println!("Principal: {:?}", channel.principal());
}Required Methods§
Sourcefn principal(&self) -> &Principal
fn principal(&self) -> &Principal
Returns the principal associated with this channel.
The principal is used for scope resolution and permission checks.
Sourcefn state(&self) -> &ChannelState
fn state(&self) -> &ChannelState
Returns a reference to the current state.
Sourcefn config(&self) -> &ChannelConfig
fn config(&self) -> &ChannelConfig
Returns a reference to the channel’s configuration.
Sourcefn ancestor_path(&self) -> &[ChannelId]
fn ancestor_path(&self) -> &[ChannelId]
Returns the cached ancestor path.
The path is ordered: [parent, grandparent, ..., root].
Provided Methods§
Sourcefn is_running(&self) -> bool
fn is_running(&self) -> bool
Returns true if the channel is in Running state.
Sourcefn is_awaiting_approval(&self) -> bool
fn is_awaiting_approval(&self) -> bool
Returns true if the channel is in AwaitingApproval state.
Sourcefn is_terminal(&self) -> bool
fn is_terminal(&self) -> bool
Returns true if the channel is in a terminal state (Completed or Aborted).
Sourcefn has_children(&self) -> bool
fn has_children(&self) -> bool
Returns true if this channel has any children.
Sourcefn is_descendant_of(&self, ancestor: ChannelId) -> bool
fn is_descendant_of(&self, ancestor: ChannelId) -> bool
Returns true if this channel is a descendant of the given ancestor.