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

Add Clone trait to csv_header and from_str_header macros #19

Closed
tobiasfunke1 opened this issue Jun 4, 2024 · 0 comments
Closed

Add Clone trait to csv_header and from_str_header macros #19

tobiasfunke1 opened this issue Jun 4, 2024 · 0 comments

Comments

@tobiasfunke1
Copy link

tobiasfunke1 commented Jun 4, 2024

Hi,

another small improvement would be adding the Clone trait to the two macros from_str_header and csv_header in https://github.com/kbalt/ezk/blob/main/crates/sip-types/src/header/mod.rs.

macro_rules! csv_header {
    ($(#[$meta:meta])* $struct_name:ident, $wrapping:ty, $header_name:expr) => {
        $(#[$meta])*
        #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]   <--- add Clone here: #[derive(Debug, Clone, PartialEq, ... )] 
        pub struct $struct_name(pub $wrapping);
...

For some non-macro generated headers Clone was added, like for the Call-ID header:

/// `Call-ID`header
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct CallID(pub BytesStr);

impl CallID {
    pub fn new<B>(id: B) -> Self
    where
        B: Into<BytesStr>,
    {
        CallID(id.into())
    }
}
...

What do you think about this?

@tobiasfunke1 tobiasfunke1 changed the title Add Clone to trait to csv_header and from_str_header macros Add Clone trait to csv_header and from_str_header macros Jun 4, 2024
@kbalt kbalt closed this as completed in 76671f5 Jun 5, 2024
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

No branches or pull requests

1 participant