mirror of
https://github.com/Drop-OSS/drop.git
synced 2026-07-25 17:24:48 +10:00
fix: re-export model trait
This commit is contained in:
@@ -15,29 +15,29 @@
|
|||||||
//!
|
//!
|
||||||
//! See examples in the [README.md](https://github.com/vincent-herlemont/native_model) file.
|
//! See examples in the [README.md](https://github.com/vincent-herlemont/native_model) file.
|
||||||
|
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
feature = "serde",
|
feature = "serde",
|
||||||
feature = "bincode_1_3",
|
feature = "bincode_1_3",
|
||||||
feature = "bincode_2_rc",
|
feature = "bincode_2_rc",
|
||||||
feature = "postcard_1_0"
|
feature = "postcard_1_0"
|
||||||
))]
|
))]
|
||||||
mod codec;
|
mod codec;
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(any(
|
||||||
feature = "serde",
|
feature = "serde",
|
||||||
feature = "bincode_1_3",
|
feature = "bincode_1_3",
|
||||||
feature = "bincode_2_rc",
|
feature = "bincode_2_rc",
|
||||||
feature = "postcard_1_0"
|
feature = "postcard_1_0"
|
||||||
))]
|
))]
|
||||||
pub use codec::*;
|
pub use codec::*;
|
||||||
mod header;
|
mod header;
|
||||||
mod model;
|
pub mod model;
|
||||||
pub mod wrapper;
|
pub mod wrapper;
|
||||||
|
|
||||||
|
// Re-export
|
||||||
pub use model::*;
|
pub use model::*;
|
||||||
|
|
||||||
/// Macro to generate a [`native_model`] implementation for a struct.
|
// Macro to generate a [`native_model`] implementation for a struct.
|
||||||
pub use native_model_macro::*;
|
pub use native_model_macro::*;
|
||||||
|
|
||||||
use wrapper::*;
|
use wrapper::*;
|
||||||
@@ -114,7 +114,7 @@ pub struct DowngradeError {
|
|||||||
/// See examples:
|
/// See examples:
|
||||||
/// - [README.md](https://github.com/vincent-herlemont/native_model) file.
|
/// - [README.md](https://github.com/vincent-herlemont/native_model) file.
|
||||||
/// - other [examples](https://github.com/vincent-herlemont/native_model/tree/master/tests/example)
|
/// - other [examples](https://github.com/vincent-herlemont/native_model/tree/master/tests/example)
|
||||||
pub fn encode<T: Model>(model: &T) -> Result<Vec<u8>> {
|
pub fn encode<T: crate::Model>(model: &T) -> Result<Vec<u8>> {
|
||||||
T::native_model_encode(model)
|
T::native_model_encode(model)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@ pub fn encode<T: Model>(model: &T) -> Result<Vec<u8>> {
|
|||||||
/// See examples:
|
/// See examples:
|
||||||
/// - [README.md](https://github.com/vincent-herlemont/native_model) file.
|
/// - [README.md](https://github.com/vincent-herlemont/native_model) file.
|
||||||
/// - other [examples](https://github.com/vincent-herlemont/native_model/tree/master/tests/example)
|
/// - other [examples](https://github.com/vincent-herlemont/native_model/tree/master/tests/example)
|
||||||
pub fn encode_downgrade<T: Model>(model: T, version: u32) -> Result<Vec<u8>> {
|
pub fn encode_downgrade<T: crate::Model>(model: T, version: u32) -> Result<Vec<u8>> {
|
||||||
T::native_model_encode_downgrade(model, version)
|
T::native_model_encode_downgrade(model, version)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,6 +130,6 @@ pub fn encode_downgrade<T: Model>(model: T, version: u32) -> Result<Vec<u8>> {
|
|||||||
/// See examples:
|
/// See examples:
|
||||||
/// - [README.md](https://github.com/vincent-herlemont/native_model) file.
|
/// - [README.md](https://github.com/vincent-herlemont/native_model) file.
|
||||||
/// - other [examples](https://github.com/vincent-herlemont/native_model/tree/master/tests/example)
|
/// - other [examples](https://github.com/vincent-herlemont/native_model/tree/master/tests/example)
|
||||||
pub fn decode<T: Model>(data: Vec<u8>) -> Result<(T, u32)> {
|
pub fn decode<T: crate::Model>(data: Vec<u8>) -> Result<(T, u32)> {
|
||||||
T::native_model_decode(data)
|
T::native_model_decode(data)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user