| Crates.io | oai-pmh |
| lib.rs | oai-pmh |
| version | 0.3.0 |
| created_at | 2025-12-15 18:35:00.022851+00 |
| updated_at | 2025-12-22 03:16:43.835719+00 |
| description | Rust library for the Open Archives Initiative Protocol for Metadata Harvesting |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1986516 |
| size | 275,132 |
Rust library for the Open Archives Initiative Protocol for Metadata Harvesting.
The immediate need and focus is for a client only. A repository may come later.
The standard practice will be to:
use oai_pmh::{Client, ListRecordsArgs, Result};
#[tokio::main]
async fn main() -> Result<()> {
let client = Client::new("https://demo.archivesspace.org/oai")?;
let response = client.identify().await?;
println!("{:?}", response.payload);
let args = ListRecordsArgs::new("oai_dc");
let mut stream = client.list_records(args).await?;
while let Some(response) = stream.next().await {
println!("{:?}", response);
break;
}
Ok(())
}
Queries that support resumption tokens return an async stream, as in client.list_records in the example.
To provide flexibilty metadata is not parsed by this library. The OAI response metadata element/s are captured as strings. The expectation is you "bring your own parser" to handle whatever metadata format is supported by the server and requested via the client.
List identifiers:
# Use defaults (test.archivesspace.org, oai_ead, 5 responses/pages)
cargo run --example list_identifiers
# Specify endpoint and metadata prefix
cargo run --example list_identifiers https://test.archivesspace.org oai_ead
# Specify number of respones/pages to fetch
cargo run --example list_identifiers https://test.archivesspace.org oai_ead 100
# Specify a different endpoint and metadata format
cargo run --example list_identifiers https://demo.archivesspace.org/oai oai_dc 5
# Basic profiling
cargo build --release --example list_identifiers
/usr/bin/time -v cargo run --example list_identifiers -- https://test.archivesspace.org/oai oai_ead 200
Other examples include: