Skip to content

Commit

Permalink
wip: Add relaxed message
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexagon committed Sep 10, 2023
1 parent 49f4f42 commit e1e36fd
Show file tree
Hide file tree
Showing 5 changed files with 466 additions and 162 deletions.
10 changes: 10 additions & 0 deletions src/cell/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ use crate::cell::{
use crate::error::Error;
use crate::util::{unlikely, Bitstring};

use super::CellFamily;

/// A data structure that can be deserialized from cells.
pub trait Load<'a>: Sized {
/// Tries to load itself from a cell slice.
Expand Down Expand Up @@ -323,6 +325,14 @@ pub struct CellSlice<'a> {
range: CellSliceRange,
}

impl Default for CellSlice<'_> {
#[inline]
fn default() -> Self {
// SAFETY: empty cell is an ordinary cell
unsafe { Cell::empty_cell_ref().as_slice_unchecked() }
}
}

impl<'a> AsRef<CellSlice<'a>> for CellSlice<'a> {
#[inline]
fn as_ref(&self) -> &CellSlice<'a> {
Expand Down
Loading

0 comments on commit e1e36fd

Please sign in to comment.