/// Given the raw bytes of the "arg" counter canister response (NOT the
/// top-level response), returns the corresponding counter value.
Given the raw bytes of the "arg" counter canister response (NOT the
top-level response), returns the corresponding counter value.
Given the raw bytes of the " arg " counter canister response ( NOT the top - level response ) returns the corresponding counter value .
fn interpret_counter_canister_response(bytes: &[u8]) -> u32 {
        if bytes.len() >= 4 {
            let first_four_bytes: &[u8] = &bytes[0..4];
            let mut bytes_as_num = [0; 4];
            bytes_as_num.copy_from_slice(first_four_bytes);
            u32::from_le_bytes(bytes_as_num)
        } else {
            0
        }
    }
fn interpret_counter_canister_response ( bytes : & [ u8 ] ) -> u32 { if bytes . len ( ) >= 4 { let first_four_bytes : & [ u8 ] = & bytes [ 0 .. 4 ] ; let mut bytes_as_num = [ 0 ; 4 ] ; bytes_as_num . copy_from_slice ( first_four_bytes ) ; u32 :: from_le_bytes ( bytes_as_num ) } else { 0 } }
Given the raw bytes of the "arg" counter canister response (NOT the
top-level response), returns the corresponding counter value.
Given the raw bytes of the " arg " counter canister response ( NOT the top - level response ) returns the corresponding counter value .
bytes
&[u8]