@@ -1603,49 +1603,52 @@ pub fn export(attr: TokenStream, item: TokenStream) -> TokenStream {
1603
1603
TokenStream :: from ( expanded)
1604
1604
}
1605
1605
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 ,
1609
1609
handlers : Vec < HandlerSpec > ,
1610
1610
}
1611
1611
1612
- impl syn:: parse:: Parse for AliasInput {
1612
+ impl syn:: parse:: Parse for BehaviorInput {
1613
1613
fn parse ( input : syn:: parse:: ParseStream ) -> syn:: Result < Self > {
1614
- let alias : Ident = input. parse ( ) ?;
1614
+ let behavior : Ident = input. parse ( ) ?;
1615
1615
let _: Token ! [ , ] = input. parse ( ) ?;
1616
1616
let raw_handlers = input. parse_terminated ( HandlerSpec :: parse, Token ! [ , ] ) ?;
1617
1617
let handlers = raw_handlers. into_iter ( ) . collect ( ) ;
1618
- Ok ( AliasInput { alias , handlers } )
1618
+ Ok ( BehaviorInput { behavior , handlers } )
1619
1619
}
1620
1620
}
1621
1621
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
1624
1624
/// 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
1626
1626
/// message types, and 4 of which need to be cast.
1627
1627
///
1628
1628
/// ```
1629
- /// hyperactor::alias !(
1630
- /// TestActorAlias ,
1629
+ /// hyperactor::behavior !(
1630
+ /// TestActorBehavior ,
1631
1631
/// TestMessage { castable = true },
1632
1632
/// () {castable = true },
1633
1633
/// MyGeneric<()> {castable = true },
1634
1634
/// u64,
1635
1635
/// );
1636
1636
/// ```
1637
1637
#[ 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 ) ;
1640
1643
let tys = HandlerSpec :: add_indexed ( handlers) ;
1641
1644
1642
1645
let expanded = quote ! {
1643
- #[ doc = "The generated alias struct." ]
1646
+ #[ doc = "The generated behavior struct." ]
1644
1647
#[ 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 { }
1647
1650
1648
- impl <A > hyperactor:: actor:: Binds <A > for #alias
1651
+ impl <A > hyperactor:: actor:: Binds <A > for #behavior
1649
1652
where
1650
1653
A : hyperactor:: Actor #( + hyperactor:: Handler <#tys>) * {
1651
1654
fn bind( ports: & hyperactor:: proc:: Ports <A >) {
@@ -1656,7 +1659,7 @@ pub fn alias(input: TokenStream) -> TokenStream {
1656
1659
}
1657
1660
1658
1661
#(
1659
- impl hyperactor:: actor:: RemoteHandles <#tys> for #alias { }
1662
+ impl hyperactor:: actor:: RemoteHandles <#tys> for #behavior { }
1660
1663
) *
1661
1664
} ;
1662
1665
0 commit comments