Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Rust quick start

#![allow(unused)]
fn main() {
extern crate btpc_core;
use btpc_core::create::{CreateMode, CreateOptions, Creator, NoProgress, PieceLength};

let options = CreateOptions::builder()
    .mode(CreateMode::Hybrid)
    .piece_length(PieceLength::Exact(16_384))
    .creation_date(0)
    .build()?;
let result = Creator::new("payload").options(options).create(&NoProgress)?;
println!("{} bytes", result.bytes().len());
Ok::<(), btpc_core::Error>(())
}

Protocol logic, traversal, hashing, canonical serialization, and verification live in btpc-core. Continue with the Rust API guide.