b3_utils 0.13.1

Utility functions for building on the Internet Computer
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use super::Wasm;
use serde_bytes::ByteBuf;

use crate::memory::types::{Bound, Storable};

impl Storable for Wasm {
    const BOUND: Bound = Bound::Unbounded;

    fn from_bytes(bytes: std::borrow::Cow<[u8]>) -> Self {
        Self(ByteBuf::from(bytes))
    }

    fn to_bytes(&self) -> std::borrow::Cow<[u8]> {
        self.0.to_vec().into()
    }
}