diff options
| author | Max Audron <audron@cocaine.farm> | 2025-02-26 17:20:15 +0100 |
|---|---|---|
| committer | Max Audron <audron@cocaine.farm> | 2025-02-26 17:20:15 +0100 |
| commit | bb861cb828dedaae880d1f0cea759d79020f6c90 (patch) | |
| tree | 0ac14b0a4ac2c4d0798621f7182fec5d435c1be0 /src/primitive/bufferid.rs | |
| parent | enable transparent repr for msgid and bufferid (diff) | |
add MsgId and BufferId to objects where needed
some objects where still handling BufferId or MsgId as their raw types
which lead to errors now that the Types are properly parsed in the
varinats
Diffstat (limited to 'src/primitive/bufferid.rs')
| -rw-r--r-- | src/primitive/bufferid.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/primitive/bufferid.rs b/src/primitive/bufferid.rs index 25cc029..4be867d 100644 --- a/src/primitive/bufferid.rs +++ b/src/primitive/bufferid.rs @@ -1,4 +1,4 @@ -#[derive(Copy, Clone, Debug, std::cmp::PartialEq)] +#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] #[repr(transparent)] pub struct BufferId(pub i32); @@ -17,6 +17,20 @@ impl Deserialize for BufferId { } } +impl From<i32> for BufferId { + fn from(value: i32) -> Self { + BufferId(value) + } +} + +impl std::ops::Deref for BufferId { + type Target = i32; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + #[cfg(test)] mod tests { use super::*; |
