ez-bencoding 0.2.0

ez-bencoding is a bencoding library, which uses the bdecode algorithm from libtorrent 3rd edition
Documentation
1
2
3
4
5
6
7
8
9
10
11
use super::token::{BdecodeToken, BdecodeTokenType};

pub trait IBdecodeNode {
    fn token_index(&self) -> usize;
    fn tokens(&self) -> std::sync::Arc<Vec<BdecodeToken>>;
    
    /// 获取当前节点的 token 的类型
    fn token_type(&self) -> BdecodeTokenType {
        self.tokens()[self.token_index() as usize].node_type()
    }
}