11use bitvec:: { order:: Lsb0 , slice:: BitSlice } ;
2- use culprit:: ResultExt ;
32use either:: Either ;
43use num:: traits:: { AsPrimitive , Bounded } ;
54use zerocopy:: { FromBytes , TryFromBytes } ;
@@ -14,9 +13,7 @@ use crate::{
1413 util:: { RangeExt , RangeIter } ,
1514} ;
1615
17- pub ( super ) fn decode_len_from_suffix < L : Level > (
18- data : & [ u8 ] ,
19- ) -> culprit:: Result < ( & [ u8 ] , usize ) , DecodeErr > {
16+ pub ( super ) fn decode_len_from_suffix < L : Level > ( data : & [ u8 ] ) -> Result < ( & [ u8 ] , usize ) , DecodeErr > {
2017 let ( data, len) = L :: ValueUnaligned :: try_read_from_suffix ( data) ?;
2118 // length is decremented when stored
2219 Ok ( ( data, len. into ( ) . as_ ( ) + 1 ) )
@@ -33,10 +30,7 @@ pub enum NonRecursivePartitionRef<'a, L: Level> {
3330}
3431
3532impl < ' a , L : Level > NonRecursivePartitionRef < ' a , L > {
36- pub fn from_suffix_with_kind (
37- kind : PartitionKind ,
38- data : & ' a [ u8 ] ,
39- ) -> culprit:: Result < Self , DecodeErr > {
33+ pub fn from_suffix_with_kind ( kind : PartitionKind , data : & ' a [ u8 ] ) -> Result < Self , DecodeErr > {
4034 match kind {
4135 PartitionKind :: Empty => Ok ( Self :: Empty ) ,
4236 PartitionKind :: Full => Ok ( Self :: Full ) ,
@@ -57,9 +51,7 @@ impl<'a, L: Level> NonRecursivePartitionRef<'a, L> {
5751 values : <[ L :: ValueUnaligned ] >:: ref_from_bytes_with_elems ( & data[ range] , len) ?,
5852 } )
5953 }
60- PartitionKind :: Run => Ok ( Self :: Run {
61- runs : RunsRef :: from_suffix ( data) . or_into_ctx ( ) ?,
62- } ) ,
54+ PartitionKind :: Run => Ok ( Self :: Run { runs : RunsRef :: from_suffix ( data) ? } ) ,
6355 PartitionKind :: Tree => unreachable ! ( "non-recursive" ) ,
6456 }
6557 }
@@ -81,7 +73,7 @@ impl<'a> NonRecursivePartitionRef<'a, Block> {
8173 kind : PartitionKind ,
8274 num_children : usize ,
8375 data : & ' a [ u8 ] ,
84- ) -> culprit :: Result < Self , DecodeErr > {
76+ ) -> Result < Self , DecodeErr > {
8577 match kind {
8678 PartitionKind :: Full => Ok ( Self :: Full ) ,
8779 PartitionKind :: Bitmap => {
@@ -326,12 +318,12 @@ pub enum PartitionRef<'a, L: Level> {
326318}
327319
328320impl < ' a , L : Level > PartitionRef < ' a , L > {
329- pub fn from_suffix ( data : & ' a [ u8 ] ) -> culprit :: Result < Self , DecodeErr > {
321+ pub fn from_suffix ( data : & ' a [ u8 ] ) -> Result < Self , DecodeErr > {
330322 let ( data, kind) = PartitionKind :: try_read_from_suffix ( data) ?;
331323 match kind {
332- PartitionKind :: Tree => Ok ( Self :: Tree ( TreeRef :: from_suffix ( data) . or_into_ctx ( ) ?) ) ,
324+ PartitionKind :: Tree => Ok ( Self :: Tree ( TreeRef :: from_suffix ( data) ?) ) ,
333325 kind => Ok ( Self :: NonRecursive (
334- NonRecursivePartitionRef :: from_suffix_with_kind ( kind, data) . or_into_ctx ( ) ?,
326+ NonRecursivePartitionRef :: from_suffix_with_kind ( kind, data) ?,
335327 ) ) ,
336328 }
337329 }
0 commit comments