z3950-rs
Minimal asynchronous (Tokio) Z39.50 client with MARC parsing via marc-rs. PDUs are encoded/decoded in ASN.1 BER using rasn.
Supported Z39.50 Requests
The library supports the following Z39.50 operations:
- Init - Initialize connection with authentication support
- Search - Type-1 query (RPN) with BIB-1 attributes
- Present - Retrieve MARC records (USMARC) and convert them to
marc_rs::Record - Scan - Browse index terms
- Sort - Sort result sets
- DeleteResultSet - Delete one or all result sets
- Close - Close connection gracefully
- ExtendedServices - Extended services support
- DuplicateDetection - Duplicate detection operations
- ResourceControl - Resource control operations
- ResourceReport - Resource reporting
- AccessControl - Access control and authentication
Usage
Library API
use Client;
use TryInto;
async
CLI Client
The library includes an interactive CLI client compatible with yaz-client commands.
Installation
Basic Usage
# Connect and use interactively
# With authentication
# JSON output format
Available Commands
Once connected, the following commands are available:
open <host:port>- Connect to a Z39.50 serverclose- Close the current connectionfind <query>- Search for records (e.g.,find rust programming)show [start] [count]- Display records (default:show 1 10)scan <term>- Browse index starting from a termset <option> <value>- Set options:set database <name>- Set database name(s), comma-separatedset result-set <name>- Set result set nameset format text|json- Set output format
get <option>- Get current option value (database, result-set, format)helpor?- Show helpquitorexit- Exit the client
Example Session
$ z3950 -s localhost:9999 -d Default
Connecting to localhost:9999...
Connected successfully!
z3950> find athena
Records: 5
Result set: default
z3950> show 1 3
=== Record 1 ===
Leader: ...
001: 123456
245 10: $aAthena
...
z3950> scan athena
"athena" (10)
"athena database" (5)
"athena query" (3)
z3950> quit
Examples
A simple example is available in examples/search.rs: