z3950-rs

Crates.ioz3950-rs
lib.rsz3950-rs
version0.2.1
created_at2026-01-23 16:22:55.80353+00
updated_at2026-01-24 07:47:07.681177+00
descriptionMinimal asynchronous (Tokio) Z39.50 client with MARC parsing
homepage
repositoryhttps://github.com/jcollonville/z3950-rs
max_upload_size
id2064911
size137,109
Jean Collonvillé (jcollonville)

documentation

README

z3950-rs

crates.io docs.rs

Minimal asynchronous (Tokio) Z39.50 client with MARC parsing via marc-rs. PDUs are encoded/decoded in ASN.1 BER using rasn.

Key features

  • Init connection
  • Search/Find with type-1 query (BIB-1, title attribute)
  • Present to retrieve MARC records (USMARC) and convert them to marc_rs::Record

Status

Basic demonstration-oriented implementation. The scan operation is not yet implemented.

Usage

use z3950_rs::Client;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let mut client = Client::connect_with_credentials(
        "z3950.loc.gov:7090",
        Some(("user", "password")),
    )
    .await?;
    let _search = client.search(&["Voyager"], "rust").await?;
    let records = client.present_marc(1, 5).await?;

    for r in records {
        if let Some(title) = r.title() {
            println!("{}", title);
        }
    }
    Ok(())
}

CLI Example

A simple example is available in examples/search.rs.

cargo run --example search -- --host z3950.loc.gov --port 7090 --db Voyager --query rust --user foo --password bar
Commit count: 10

cargo fmt