@@ -1603,49 +1603,52 @@ pub fn export(attr: TokenStream, item: TokenStream) -> TokenStream {
16031603 TokenStream :: from ( expanded)
16041604}
16051605
1606- /// Represents the full input to [`fn alias `].
1607- struct AliasInput {
1608- alias : Ident ,
1606+ /// Represents the full input to [`fn behavior `].
1607+ struct BehaviorInput {
1608+ behavior : Ident ,
16091609 handlers : Vec < HandlerSpec > ,
16101610}
16111611
1612- impl syn:: parse:: Parse for AliasInput {
1612+ impl syn:: parse:: Parse for BehaviorInput {
16131613 fn parse ( input : syn:: parse:: ParseStream ) -> syn:: Result < Self > {
1614- let alias : Ident = input. parse ( ) ?;
1614+ let behavior : Ident = input. parse ( ) ?;
16151615 let _: Token ! [ , ] = input. parse ( ) ?;
16161616 let raw_handlers = input. parse_terminated ( HandlerSpec :: parse, Token ! [ , ] ) ?;
16171617 let handlers = raw_handlers. into_iter ( ) . collect ( ) ;
1618- Ok ( AliasInput { alias , handlers } )
1618+ Ok ( BehaviorInput { behavior , handlers } )
16191619 }
16201620}
16211621
1622- /// Create a [`Referable`] handling a specific set of message types.
1623- /// This is used to create an [`ActorRef`] without having to depend on the
1622+ /// Create a [`Referable`] definition, handling a specific set of message types.
1623+ /// Behaviors are used to create an [`ActorRef`] without having to depend on the
16241624/// actor's implementation. If the message type need to be cast, add `castable`
1625- /// flag to those types. e.g. the following example creats an alias with 5
1625+ /// flag to those types. e.g. the following example creates a behavior with 5
16261626/// message types, and 4 of which need to be cast.
16271627///
16281628/// ```
1629- /// hyperactor::alias !(
1630- /// TestActorAlias ,
1629+ /// hyperactor::behavior !(
1630+ /// TestActorBehavior ,
16311631/// TestMessage { castable = true },
16321632/// () {castable = true },
16331633/// MyGeneric<()> {castable = true },
16341634/// u64,
16351635/// );
16361636/// ```
16371637#[ proc_macro]
1638- pub fn alias ( input : TokenStream ) -> TokenStream {
1639- let AliasInput { alias, handlers } = parse_macro_input ! ( input as AliasInput ) ;
1638+ pub fn behavior ( input : TokenStream ) -> TokenStream {
1639+ let BehaviorInput {
1640+ behavior : behavior,
1641+ handlers,
1642+ } = parse_macro_input ! ( input as BehaviorInput ) ;
16401643 let tys = HandlerSpec :: add_indexed ( handlers) ;
16411644
16421645 let expanded = quote ! {
1643- #[ doc = "The generated alias struct." ]
1646+ #[ doc = "The generated behavior struct." ]
16441647 #[ derive( Debug , hyperactor:: Named , serde:: Serialize , serde:: Deserialize ) ]
1645- pub struct #alias ;
1646- impl hyperactor:: actor:: Referable for #alias { }
1648+ pub struct #behavior ;
1649+ impl hyperactor:: actor:: Referable for #behavior { }
16471650
1648- impl <A > hyperactor:: actor:: Binds <A > for #alias
1651+ impl <A > hyperactor:: actor:: Binds <A > for #behavior
16491652 where
16501653 A : hyperactor:: Actor #( + hyperactor:: Handler <#tys>) * {
16511654 fn bind( ports: & hyperactor:: proc:: Ports <A >) {
@@ -1656,7 +1659,7 @@ pub fn alias(input: TokenStream) -> TokenStream {
16561659 }
16571660
16581661 #(
1659- impl hyperactor:: actor:: RemoteHandles <#tys> for #alias { }
1662+ impl hyperactor:: actor:: RemoteHandles <#tys> for #behavior { }
16601663 ) *
16611664 } ;
16621665
0 commit comments