Skip to content

Commit

Permalink
clarify doc
Browse files Browse the repository at this point in the history
  • Loading branch information
a10y committed Aug 15, 2024
1 parent a6ade02 commit 4fbbb99
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
11 changes: 8 additions & 3 deletions examples/file_compressor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
10 changes: 2 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 4fbbb99

Please sign in to comment.