ton_lib_core 0.0.7

A collection of types and utilities for interacting with the TON network
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::cell::CellBuilder;
use crate::cell::CellParser;
use crate::error::TLCoreError;
use crate::traits::tlb::TLB;
use std::ops::Deref;
use std::sync::Arc;

impl<T: TLB> TLB for Arc<T> {
    fn read_definition(parser: &mut CellParser) -> Result<Self, TLCoreError> { Ok(Arc::new(T::read(parser)?)) }

    fn write_definition(&self, builder: &mut CellBuilder) -> Result<(), TLCoreError> { self.deref().write(builder) }
}

impl<T: TLB> TLB for Box<T> {
    fn read_definition(parser: &mut CellParser) -> Result<Self, TLCoreError> { Ok(Box::new(T::read(parser)?)) }

    fn write_definition(&self, builder: &mut CellBuilder) -> Result<(), TLCoreError> { self.deref().write(builder) }
}