mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-06-08 08:19:26 +00:00
BREAKING CHANGE: LEZ crates have been moved from top-level directories into
a dedicated `lez/` subdirectory. The following crates were relocated:
common → lez/common
indexer → lez/indexer
explorer_service→ lez/explorer_service
keycard_wallet → lez/keycard_wallet
mempool → lez/mempool
sequencer → lez/sequencer
storage → lez/storage
testnet_initial_state → lez/testnet_initial_state
wallet → lez/wallet
wallet-ffi → lez/wallet-ffi
Any external tooling, scripts, or paths referencing these crates at their
previous top-level locations must be updated.
30 lines
731 B
Rust
30 lines
731 B
Rust
/// Simple wrapper around a pointer to a value or an error.
|
|
///
|
|
/// Pointer is not guaranteed. You should check the error field before
|
|
/// dereferencing the pointer.
|
|
#[repr(C)]
|
|
pub struct PointerResult<Type, Error> {
|
|
pub value: *mut Type,
|
|
pub error: Error,
|
|
}
|
|
|
|
impl<Type, Error: Default> PointerResult<Type, Error> {
|
|
pub fn from_pointer(pointer: *mut Type) -> Self {
|
|
Self {
|
|
value: pointer,
|
|
error: Error::default(),
|
|
}
|
|
}
|
|
|
|
pub fn from_value(value: Type) -> Self {
|
|
Self::from_pointer(Box::into_raw(Box::new(value)))
|
|
}
|
|
|
|
pub const fn from_error(error: Error) -> Self {
|
|
Self {
|
|
value: std::ptr::null_mut(),
|
|
error,
|
|
}
|
|
}
|
|
}
|