-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add SubscriptionInformation struct to usubscription #179
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,41 @@ pub use crate::up_core_api::usubscription::{ | |
|
||
use crate::{UStatus, UUri}; | ||
|
||
// Tracks information for the SubscriptionCache | ||
pub struct SubscriptionInformation { | ||
pub topic: UUri, | ||
pub subscriber: SubscriberInfo, | ||
pub status: SubscriptionStatus, | ||
pub attributes: SubscribeAttributes, | ||
pub config: EventDeliveryConfig, | ||
} | ||
|
||
impl Eq for SubscriptionInformation {} | ||
|
||
impl PartialEq for SubscriptionInformation { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think some comment explaining the choice to use |
||
fn eq(&self, other: &Self) -> bool { | ||
self.subscriber == other.subscriber | ||
} | ||
} | ||
|
||
impl Hash for SubscriptionInformation { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggest adding similar level of doc comment and doc example as below There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same sort of comment as above -- good to explain here why only the |
||
fn hash<H: Hasher>(&self, state: &mut H) { | ||
self.subscriber.hash(state); | ||
} | ||
} | ||
|
||
impl Clone for SubscriptionInformation { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to explicitly Reference this Rust Playground snippet. Would it suffice to derive |
||
fn clone(&self) -> Self { | ||
Self { | ||
topic: self.topic.clone(), | ||
subscriber: self.subscriber.clone(), | ||
status: self.status.clone(), | ||
attributes: self.attributes.clone(), | ||
config: self.config.clone(), | ||
} | ||
} | ||
} | ||
|
||
impl Hash for SubscriberInfo { | ||
/// Creates a hash value based on the URI property. | ||
/// | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use triple forward slashes for doc comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to expand this a bit with a code usage example a in triple tick block, e.g.
that way it'll be compiled and tested.