Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handler 続き #233

Open
2 tasks
H1rono opened this issue Nov 9, 2024 · 11 comments
Open
2 tasks

Handler 続き #233

H1rono opened this issue Nov 9, 2024 · 11 comments
Labels
enhancement New feature or request

Comments

@H1rono
Copy link
Owner

H1rono commented Nov 9, 2024

#231 から

@H1rono H1rono added the enhancement New feature or request label Nov 9, 2024
@H1rono
Copy link
Owner Author

H1rono commented Nov 9, 2024

handler modがprivateでも問題ないことに気づいちゃった
やらない、docsを公開するため

@H1rono
Copy link
Owner Author

H1rono commented Nov 9, 2024

✅ ここのcloneself.serviceに対してだけでいい

let mut s = self.clone();
// https://docs.rs/tower/latest/tower/trait.Service.html#be-careful-when-cloning-inner-services
std::mem::swap(self, &mut s);

@H1rono
Copy link
Owner Author

H1rono commented Nov 9, 2024

packages.metadata.docs.rs更新しないと docs.rs で見えない

features = ["http"]

@H1rono
Copy link
Owner Author

H1rono commented Nov 10, 2024

✅ READMEにtowerfeatureのこと書いてない

@H1rono
Copy link
Owner Author

H1rono commented Nov 10, 2024

EventWithState消せる

@H1rono
Copy link
Owner Author

H1rono commented Nov 10, 2024

<WithState as Service>::poll_readyの実装ミス

fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(()))

fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
Poll::Ready(Ok(()))

self.service.poll_ready(cx)をtransparentさせる必要がある

@H1rono
Copy link
Owner Author

H1rono commented Nov 10, 2024

impl<Service, Fallback> ::tower::Service<$crate::Event>
for [< $e:camel Service >] <Service, Fallback, $crate::payloads::[< $e:camel Payload >] >
where
Service: ::tower::Service<$crate::payloads::[< $e:camel Payload >], Response = ()>,

これに対応した1-tupleの実装 やらない

        impl<Service, Fallback> ::tower::Service<$crate::Event>
        for [< $e:camel Service >] <Service, Fallback, $crate::payloads::[< $e:camel Payload >] >
        where
            Service: ::tower::Service<($crate::payloads::[< $e:camel Payload >],), Response = ()>, ...

@H1rono
Copy link
Owner Author

H1rono commented Nov 10, 2024

Handler::boxed_inner(self)
-> Handler<BoxCloneService<Event, (), Error>>;

@H1rono
Copy link
Owner Author

H1rono commented Nov 27, 2024

Handler::check_cloneとかあると嬉しそう
https://docs.rs/tower/0.5.1/tower/builder/struct.ServiceBuilder.html#method.check_clone

@H1rono
Copy link
Owner Author

H1rono commented Dec 6, 2024

Srv: Service<..., Error = crate::Error>にできる

Srv: Service<Event, Response = ()> + Send + 'static,
Srv: Clone,
Srv::Error: Into<Box<dyn std::error::Error + Send + Sync + 'static>>,

が、これを入れるとHandler::newが厳しくなる

@H1rono
Copy link
Owner Author

H1rono commented Dec 7, 2024

{EventKind}Serviceの型名をOn{EventKind}にrenameしたい(API Guidelinesで見かけた気がしたけどなかった、よく見るライブラリのnaming conventionに従うとこうなる)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant