pub struct ServiceUnit {
pub name: ServiceIdent,
pub extends: Vec<ServiceIdent>,
pub funcs: Vec<ServiceFunc>,
pub events: Vec<ServiceEvent>,
pub types: Vec<Type>,
pub docs: Vec<String>,
pub annotations: Vec<Annotation>,
}Expand description
AST node describing a service definition.
A service is an interface that:
- may
extendsother services, inheriting their events, functions and types, - defines
funcsinfunctions { ... }, - defines
eventsinevents { ... }, - defines service-local
types { ... }, - may contain documentation comments and annotations.
Fields§
§name: ServiceIdent§extends: Vec<ServiceIdent>§funcs: Vec<ServiceFunc>§events: Vec<ServiceEvent>§types: Vec<Type>§docs: Vec<String>§annotations: Vec<Annotation>Implementations§
Source§impl ServiceUnit
impl ServiceUnit
Sourcepub fn interface_id(&self) -> Result<InterfaceId, String>
pub fn interface_id(&self) -> Result<InterfaceId, String>
Compute a deterministic interface identifier for this service.
The hash incorporates:
- all functions (kind, name, params, output, optional throws),
- all events (their payload shape),
- all base services by their already-computed interface IDs.
Types referenced by functions or events are expanded via the AST
definitions in self.types, including generic instantiation.
Source§impl ServiceUnit
impl ServiceUnit
Sourcepub fn normalize(&mut self)
pub fn normalize(&mut self)
Stabilize ordering for deterministic output and comparisons.
Also computes entry_id for each func and event from @entry_id annotation,
falling back to declaration-order index.
Sourcepub fn is_partial(&self) -> bool
pub fn is_partial(&self) -> bool
Returns true if the service is annotated with @partial.
Partial services describe a subset of an existing on-chain service and require
explicit @entry_id annotations on all functions and events.
Trait Implementations§
Source§impl Clone for ServiceUnit
impl Clone for ServiceUnit
Source§fn clone(&self) -> ServiceUnit
fn clone(&self) -> ServiceUnit
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ServiceUnit
impl Debug for ServiceUnit
Source§impl PartialEq for ServiceUnit
impl PartialEq for ServiceUnit
Source§fn eq(&self, other: &ServiceUnit) -> bool
fn eq(&self, other: &ServiceUnit) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ServiceUnit
Auto Trait Implementations§
impl Freeze for ServiceUnit
impl RefUnwindSafe for ServiceUnit
impl Send for ServiceUnit
impl Sync for ServiceUnit
impl Unpin for ServiceUnit
impl UnsafeUnpin for ServiceUnit
impl UnwindSafe for ServiceUnit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more