Skip to content

Commit

Permalink
endpoint: 统一针对trait的Deref的定义
Browse files Browse the repository at this point in the history
  • Loading branch information
icycrystal4 committed Nov 13, 2023
1 parent cdd2137 commit 1ec5968
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion endpoint/src/topo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ procs::topology_dispatcher! {
UuidService(crate::uuid::topo::UuidService<B, E, R, P>),
}

#[procs::dispatcher_trait_deref]
#[procs::dispatcher_trait_deref]
pub trait Endpoint: Sized + Send + Sync {
type Item;
fn send(&self, req: Self::Item);
Expand Down
4 changes: 4 additions & 0 deletions procs/src/endpoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ pub fn topology_dispatcher(input: TokenStream) -> TokenStream {
// 2. 使用每个单词的首字母
let caps: String = s.chars().filter(|c| c.is_uppercase()).collect();
endpoints.push(caps.to_lowercase());
// 3. 特殊处理
if s.eq("PhantomService") {
endpoints.push("pt".to_string());
}

quote! {
#(#endpoints) | * => Ok(Self::#variant_ident(p.into())),
Expand Down

0 comments on commit 1ec5968

Please sign in to comment.