Skip to main content

Crate rsword_chirho

Crate rsword_chirho 

Source
Expand description

§rsword_chirho

Pure Rust port of the SWORD Bible software library.

This crate provides full compatibility with SWORD module binary formats, including reading and writing Bible texts, commentaries, lexicons, and general books.

§Quick Start

Load installed SWORD modules and look up a verse:

use rsword_chirho::{SwMgrChirho, VerseKeyChirho};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Load modules from system paths (~/.sword, /usr/share/sword, etc.)
    let mgr_chirho = SwMgrChirho::with_system_paths_chirho()?;

    // List available modules
    for name_chirho in mgr_chirho.get_module_names_chirho() {
        println!("Found module: {}", name_chirho);
    }

    // Get a Bible module and look up a verse
    if let Some(mut module_chirho) = mgr_chirho.get_module_driver_chirho("KJV")? {
        let key_chirho = VerseKeyChirho::from_str_chirho("John 3:16")?;
        module_chirho.set_key_chirho(&key_chirho)?;
        let text_chirho = module_chirho.get_raw_entry_chirho()?;
        println!("{}: {}", key_chirho, text_chirho);
    }

    Ok(())
}

§Verse Navigation

Use VerseKeyChirho for Bible verse references:

use rsword_chirho::VerseKeyChirho;

// Parse verse references
let mut key_chirho = VerseKeyChirho::from_str_chirho("Genesis 1:1").unwrap();

// Navigate forward
key_chirho.increment_chirho(1);
println!("Now at: {}", key_chirho); // Genesis 1:2

// Parse various formats
let _ = VerseKeyChirho::from_str_chirho("Gen 1:1").unwrap();    // Abbreviation
let _ = VerseKeyChirho::from_str_chirho("1 John 3:16").unwrap(); // Numbered book
let _ = VerseKeyChirho::from_str_chirho("Rev 22:21").unwrap();   // Last verse

§Versification Systems

Different Bible traditions use different verse numbering systems:

use rsword_chirho::versification_chirho::{get_versification_chirho, VersificationManagerChirho};

// Get versification by name
let kjv_v11n_chirho = get_versification_chirho("KJV").unwrap();
let catholic_v11n_chirho = get_versification_chirho("Catholic").unwrap();
let lxx_v11n_chirho = get_versification_chirho("LXX").unwrap();

// Available systems: KJV, Catholic, LXX, Synodal, Luther, Vulgate, NRSV, Leningrad, Ethiopian
let manager_chirho = VersificationManagerChirho::new_chirho();
for v11n_name_chirho in manager_chirho.list_available_chirho() {
    println!("Available: {}", v11n_name_chirho);
}

§Search

Search module content using regex or indexed search:

use rsword_chirho::{SearchOptionsChirho, SearchTypeChirho};

// Create search options
let options_chirho = SearchOptionsChirho::new_chirho()
    .with_type_chirho(SearchTypeChirho::PhraseChirho)
    .case_insensitive_chirho(true)
    .with_max_results_chirho(100);

§Module Types

Supported SWORD module formats:

TypeDescriptionStorage Formats
Biblical TextsBible translationsRawText, zText
CommentariesVerse-keyed commentaryRawCom, zCom
LexiconsDictionaries/lexiconsRawLD, zLD
General BooksTree-structured contentRawGenBook
Daily DevotionalDate-keyed devotionsRawCom
ImagesMaps and images-

§Filters

Convert between markup formats:

use rsword_chirho::{FilterChirho, OsisToHtmlFilterChirho, FilterOptionsChirho};

let filter_chirho = OsisToHtmlFilterChirho::new_chirho();
let options_chirho = FilterOptionsChirho::default();

// Convert OSIS markup to HTML
let osis_chirho = r#"<verse osisID="John.3.16">For God so loved...</verse>"#;
let html_chirho = filter_chirho.process_chirho(osis_chirho, &options_chirho);

§Feature Flags

Optional features controlled via Cargo.toml:

  • bzip2 - bzip2 compression support (default)
  • xz - xz/lzma compression support (default)
  • search - Tantivy full-text search (default)
  • parallel - Parallel processing with rayon

Re-exports§

pub use error_chirho::ErrorChirho;
pub use error_chirho::ResultChirho;
pub use keys_chirho::sw_key_chirho::SwKeyChirho;
pub use keys_chirho::verse_key_chirho::VerseKeyChirho;
pub use keys_chirho::list_key_chirho::ListKeyChirho;
pub use modules_chirho::sw_module_chirho::SwModuleChirho;
pub use modules_chirho::texts_chirho::RawTextChirho;
pub use manager_chirho::sw_mgr_chirho::SwMgrChirho;
pub use manager_chirho::install_mgr_chirho::InstallMgrChirho;
pub use config_chirho::InstallSourceChirho;
pub use versification_chirho::VersificationChirho;
pub use versification_chirho::TestamentChirho;
pub use versification_chirho::BookInfoChirho;
pub use versification_chirho::kjv_chirho;
pub use versification_chirho::catholic_chirho;
pub use versification_chirho::lxx_chirho;
pub use versification_chirho::synodal_chirho;
pub use versification_chirho::get_versification_chirho;
pub use search_chirho::SearchEngineChirho;
pub use search_chirho::SearchOptionsChirho;
pub use search_chirho::SearchTypeChirho;
pub use search_chirho::RegexSearchChirho;
pub use search_chirho::TantivySearchChirho;
pub use filters_chirho::FilterChirho;
pub use filters_chirho::FilterOptionsChirho;
pub use filters_chirho::FilterChainChirho;
pub use filters_chirho::OsisToHtmlFilterChirho;
pub use filters_chirho::OsisToPlainFilterChirho;
pub use filters_chirho::ThmlToHtmlFilterChirho;
pub use filters_chirho::ThmlToPlainFilterChirho;
pub use filters_chirho::GbfToHtmlFilterChirho;
pub use filters_chirho::GbfToPlainFilterChirho;
pub use filters_chirho::InterlinearWordDataChirho;
pub use filters_chirho::extract_interlinear_words_chirho;
pub use locale_chirho::LocaleChirho;
pub use locale_chirho::LocaleBookChirho;
pub use locale_chirho::LocaleManagerChirho;
pub use locale_chirho::english_locale_chirho;
pub use locale_chirho::get_locale_chirho;
pub use locale_chirho::DEFAULT_LOCALE_CHIRHO;
pub use cipher_chirho::CipherChirho;
pub use cipher_chirho::CipherTypeChirho;
pub use cipher_chirho::SwCipherChirho;
pub use cipher_chirho::SapphireCipherChirho;
pub use cipher_chirho::XorCipherChirho;
pub use cipher_chirho::NullCipherChirho;
pub use cipher_chirho::create_cipher_chirho;
pub use parallels_chirho::ParallelPassageChirho;
pub use parallels_chirho::ParallelSetChirho;
pub use parallels_chirho::ParallelTypeChirho;
pub use parallels_chirho::ParallelManagerChirho;

Modules§

byte_order_chirho
Byte order utilities for reading SWORD module binary files.
cache_chirho
Caching layer for module content.
cipher_chirho
Module encryption and decryption support.
compression_chirho
Compression support for SWORD modules.
config_chirho
Configuration file parser for SWORD modules.
error_chirho
Error types for the rsword_chirho library.
filters_chirho
Text filters for markup conversion.
import_chirho
Module import functionality.
keys_chirho
Key types for navigating SWORD modules.
locale_chirho
Locale support for internationalized book names and abbreviations.
manager_chirho
Module management functionality.
module_type_chirho
Module types
modules_chirho
SWORD module implementations.
parallels_chirho
Parallel passage detection for identifying related Scripture passages.
search_chirho
Full-text search functionality.
storage_chirho
Storage backends for SWORD modules.
transport_chirho
Network transport for module downloads.
versification_chirho
Versification systems for Bible navigation.

Enums§

BlockTypeChirho
Block types for compressed modules
CompressionTypeChirho
Compression types
DirectionChirho
Text direction
EncodingChirho
Text encoding
MarkupChirho
Source markup format

Constants§

DEFAULT_V11N_CHIRHO
Default versification system
VERSION_CHIRHO
Library version