Skip to main content

protected

Attribute Macro protected 

Source
#[protected]
Expand description

Marks a method as protected (entity-to-entity only).

Protected methods can be called by:

  • Other entities via entity-to-entity communication
  • Internal code within the same entity

They CANNOT be called by external clients.

§Usage

#[entity_impl]
impl MyEntity {
    #[rpc]
    #[protected]
    async fn internal_sync(&self, data: SyncData) -> Result<(), ClusterError> {
        // Only other entities can call this
        self.apply_sync(data)
    }
}

§Use Cases

  • Inter-entity synchronization
  • Internal cluster coordination
  • Methods that should not be exposed to external APIs