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

Update: Requests pattern #12

Merged

Conversation

RaulTrombin
Copy link
Member

@RaulTrombin RaulTrombin commented Aug 1, 2024

@RaulTrombin RaulTrombin mentioned this pull request Aug 1, 2024
2 tasks
@RaulTrombin RaulTrombin force-pushed the update_request_pattern branch 6 times, most recently from c9b1c19 to 6a9aa25 Compare August 7, 2024 02:01
@RaulTrombin RaulTrombin marked this pull request as ready for review August 7, 2024 02:04
Comment on lines 162 to 173
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct UuidWrapper {
pub uuid: Uuid,
}

impl UuidWrapper {
pub fn uuid(&self) -> Uuid {
self.uuid
}
}

impl From<Uuid> for UuidWrapper {
fn from(uuid: Uuid) -> Self {
UuidWrapper { uuid }
}
}

impl From<UuidWrapper> for Uuid {
fn from(wrapper: UuidWrapper) -> Self {
wrapper.uuid
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can instead, implement deref trait:

impl Deref for UuidWrapper {
    type Target = Uuid;

    fn deref(&self) -> &Self::Target {
        &self.uuid
    }
}

then use *uuid instead of uuid.into()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thks

@joaoantoniocardoso joaoantoniocardoso merged commit 27f071b into bluerobotics:master Aug 8, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants