-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wip] refactor towards a design where a minimal set of traits defines…
… data types, and then FieldCopyAccess and FieldView are defined based on those
- Loading branch information
Showing
28 changed files
with
2,920 additions
and
2,824 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use crate::view::FieldView; | ||
use crate::Field; | ||
|
||
pub trait DataTypeMetadata { | ||
const SIZE: Option<usize>; | ||
|
||
type View<S, F>: FieldView<S, F> | ||
where | ||
F: Field; | ||
} | ||
|
||
pub mod primitive; | ||
pub mod slice; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
139 changes: 51 additions & 88 deletions
139
...ds/primitive/copy_access/primitive_int.rs → src/data_types/primitive/int.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use crate::endianness::Endianness; | ||
|
||
pub trait PrimitiveRead: Sized { | ||
type Error; | ||
|
||
fn try_read<E: Endianness>(storage: &[u8]) -> Result<Self, Self::Error>; | ||
} | ||
|
||
pub trait PrimitiveWrite: Sized { | ||
type Error; | ||
|
||
fn try_write<E: Endianness>(self, storage: &mut [u8]) -> Result<(), Self::Error>; | ||
} | ||
|
||
mod float; | ||
mod int; | ||
mod nonzero_int; | ||
mod unit; | ||
|
||
pub use nonzero_int::NonZeroIsZeroError; |
Oops, something went wrong.