dapr/rust-sdk

Misleading comment in the Invoke example

NickLarsenNZ opened this issue · 3 comments

Looks like it was copy/pasted from the pubsub example.

Topic A Is not returned here, only the default (which is an empty list, given Vec is Default over T):

/// Lists all topics subscribed by this app.
///
/// NOTE: Dapr runtime will call this method to get
/// the list of topics the app wants to subscribe to.
/// In this example, the app is subscribing to topic `A`.
async fn list_topic_subscriptions(
&self,
_request: Request<()>,
) -> Result<Response<ListTopicSubscriptionsResponse>, Status> {
let list_subscriptions = ListTopicSubscriptionsResponse::default();
Ok(Response::new(list_subscriptions))
}

Perhaps it should read something like:

/// Return an empty list of topics. 

... but on that note, should the trait methods provide these default behaviours so we don't have to implement defaults for each unused method?

should the trait methods provide these default behaviours so we don't have to implement defaults for each unused method?

I'm not sure it is easily possible, since the trait is generated from proto files.
I'm unaware of a way to provide default implementations for trait methods generated this way.

tonic::include_proto!("dapr.proto.runtime.v1");


Update: I've asked the question over here: tokio-rs/prost#844

This issue has been automatically marked as stale because it has not had activity in the last 60 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted) or other activity occurs. Thank you for your contributions.

This issue has been automatically closed because it has not had activity in the last 67 days. If this issue is still valid, please ping a maintainer and ask them to label it as pinned, good first issue or help wanted. Thank you for your contributions.