Skip to content
This repository was archived by the owner on Aug 27, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ license = "MIT"
description = "macros and helpers for parsing netlink messages"
readme = "README.md"

[features]
serde = ["dep:serde"]

[dependencies]
byteorder = "1.3.2"
pastey = "0.1.0"
serde = { version = "1", features = ["derive"], optional = true }
thiserror = "2"
9 changes: 5 additions & 4 deletions src/errors.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// SPDX-License-Identifier: MIT

use thiserror::Error;

#[derive(Debug, Error)]
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum EncodeError {
#[error(transparent)]
Expand All @@ -23,7 +21,7 @@ impl From<String> for EncodeError {
}
}

#[derive(Debug, Error)]
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum DecodeError {
#[error(
Expand Down Expand Up @@ -58,6 +56,9 @@ pub enum DecodeError {
Other(#[from] Box<dyn std::error::Error>),
}

unsafe impl Send for DecodeError {}
unsafe impl Sync for DecodeError {}

impl From<&str> for DecodeError {
fn from(msg: &str) -> Self {
let error: Box<dyn std::error::Error> = msg.to_string().into();
Expand Down
1 change: 1 addition & 0 deletions src/nla.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ impl<T: AsRef<[u8]> + AsMut<[u8]> + ?Sized> NlaBuffer<&mut T> {
}

#[derive(Debug, PartialEq, Eq, Clone)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct DefaultNla {
kind: u16,
value: Vec<u8>,
Expand Down