pub fn decode(input: &str) -> Result<Self> {
        let rev: RevisionMap =
            serde_json::from_str(input).map_err(|e| ExtractError::DecodeMap(input.into(), e))?;
        let size = rev.size;
        if size % CHUNKSZ as u64 != 0 {
            return Err(ExtractError::UnalignedSize(rev.size));
        }
        let mut chunks = BTreeMap::new();
        let mut zero_seqs = Vec::new();
        for (seq, id) in rev {
            if let Some(id) = id {
                chunks.entry(id).or_insert_with(SmallVec::new).push(seq);
            } else {
                zero_seqs.push(seq);
            }
        }
        Ok(Self {
            size,
            chunks,
            zero_seqs,
        })
    }
/// Parses backup spec JSON and constructs chunk map.
Parses backup spec JSON and constructs chunk map.
Parses backup spec JSON and constructs chunk map .
pub fn decode(input: &str) -> Result<Self> {
        let rev: RevisionMap =
            serde_json::from_str(input).map_err(|e| ExtractError::DecodeMap(input.into(), e))?;
        let size = rev.size;
        if size % CHUNKSZ as u64 != 0 {
            return Err(ExtractError::UnalignedSize(rev.size));
        }
        let mut chunks = BTreeMap::new();
        let mut zero_seqs = Vec::new();
        for (seq, id) in rev {
            if let Some(id) = id {
                chunks.entry(id).or_insert_with(SmallVec::new).push(seq);
            } else {
                zero_seqs.push(seq);
            }
        }
        Ok(Self {
            size,
            chunks,
            zero_seqs,
        })
    }
pub fn decode ( input : & str ) -> Result < Self > { let rev : RevisionMap = serde_json :: from_str ( input ) . map_err ( | e | ExtractError :: DecodeMap ( input . into ( ) , e ) ) ? ; let size = rev . size ; if size % CHUNKSZ as u64 != 0 { return Err ( ExtractError :: UnalignedSize ( rev . size ) ) ; } let mut chunks = BTreeMap :: new ( ) ; let mut zero_seqs = Vec :: new ( ) ; for ( seq , id ) in rev { if let Some ( id ) = id { chunks . entry ( id ) . or_insert_with ( SmallVec :: new ) . push ( seq ) ; } else { zero_seqs . push ( seq ) ; } } Ok ( Self { size , chunks , zero_seqs , } ) }
Parses backup spec JSON and constructs chunk map.
Parses backup spec JSON and constructs chunk map .
input
&str
input
&str