| Crates.io | kmip-derive |
| lib.rs | kmip-derive |
| version | 5.9.0 |
| created_at | 2025-05-09 02:35:11.261338+00 |
| updated_at | 2025-09-15 16:11:38.955896+00 |
| description | Cosmian KMIP Derive Macros |
| homepage | |
| repository | https://github.com/Cosmian/kms |
| max_upload_size | |
| id | 1666088 |
| size | 15,563 |
The KMIP Derive crate provides procedural macros for automatic serialization and deserialization of KMIP (Key Management Interoperability Protocol) data structures.
This crate contains derive macros that automatically generate the necessary code for converting Rust data structures to and from the KMIP binary format. It simplifies the implementation of KMIP protocol support by eliminating boilerplate serialization code.
#[derive(Serialize)]Automatically implements KMIP serialization for structs and enums:
use kmip_derive::Serialize;
#[derive(Serialize)]
struct MyKmipRequest {
operation: Operation,
unique_identifier: Option<String>,
attributes: Vec<Attribute>,
}
#[derive(Deserialize)]Automatically implements KMIP deserialization for structs and enums:
use kmip_derive::Deserialize;
#[derive(Deserialize)]
struct MyKmipResponse {
result_status: ResultStatus,
result_reason: Option<ResultReason>,
result_message: Option<String>,
}
The macros support all KMIP data types and structures:
The macros generate highly optimized code that:
Add the derive macros to your KMIP data structures:
use kmip_derive::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CreateRequest {
pub object_type: ObjectType,
pub template_attribute: TemplateAttribute,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CreateResponse {
pub object_type: ObjectType,
pub unique_identifier: String,
}
The generated code provides comprehensive error handling:
This crate is used by the cosmian_kmip crate to automatically generate serialization code for all KMIP message types. It's an internal implementation detail that enables the seamless handling of KMIP protocol messages.
The generated code is highly optimized:
This crate is part of the Cosmian KMS project and is licensed under the Business Source License 1.1 (BUSL-1.1).