From 4fbbb99815ff30ec3c9937cc3b4644e66d86b0ef Mon Sep 17 00:00:00 2001 From: Andrew Duffy Date: Wed, 14 Aug 2024 22:51:13 -0400 Subject: [PATCH] clarify doc --- examples/file_compressor.rs | 11 ++++++++--- src/lib.rs | 10 ++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/examples/file_compressor.rs b/examples/file_compressor.rs index f820971..c116d99 100644 --- a/examples/file_compressor.rs +++ b/examples/file_compressor.rs @@ -4,9 +4,14 @@ //! //! The first is the file to train a symbol table on. //! -//! The second is the file to compress. The compressed file will be written -//! as a sibling with the suffix ".fsst" - +//! The second is the file to compress. The compressor will run and compress +//! in chunks of 16MB, logging the compression ratio for each chunk. +//! +//! Example: +//! +//! ``` +//! cargo run --release --example file_compressor -- file1.csv file2.csv +//! ``` use std::{ fs::File, io::Read, diff --git a/src/lib.rs b/src/lib.rs index da195a2..c5896b6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -76,10 +76,7 @@ impl Symbol { /// Get the first byte of the symbol as a `u8`. /// - /// # Safety - /// The function will never panic, but if the symbol's len is < 1, the - /// result may be meaningless. It is up to the caller to ensure that - /// the first byte of the symbol contains valid data. + /// If the symbol is empty, this will return the zero byte. #[inline] pub fn first_byte(&self) -> u8 { // SAFETY: the bytes can always be viewed as a u64 @@ -88,10 +85,7 @@ impl Symbol { /// Get the first two bytes of the symbol as a `u16`. /// - /// # Safety - /// The function will never panic, but if the symbol's len is < 2, the - /// result may be meaningless. It is up to the caller to ensure that - /// the first two bytes of the symbol contain valid data. + /// If the Symbol is one or zero bytes, this will return `0u16`. #[inline] pub fn first_two_bytes(&self) -> u16 { // SAFETY: the bytes can always be viewed as a u64