Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.law4devs.eu/llms.txt

Use this file to discover all available pages before exploring further.

Methods

client.search.query(
    q: &str,
    framework: Option<&str>,
    result_type: Option<&str>,
    page: Option<u32>,
    per_page: Option<u32>,
) -> Result<Page<SearchResult>, Law4DevsError>

client.search.iter(
    q: &str,
    framework: Option<&str>,
    result_type: Option<&str>,
    per_page: u32,
) -> impl Stream<Item = Result<SearchResult, Law4DevsError>>

let results = client
    .search
    .query("incident notification 72 hours", None, None, None, None)
    .await?;

println!("Found {} results", results.meta.total);
for r in &results.data {
    println!("[{}] {} {}: {}", r.framework_slug.to_uppercase(), r.result_type, r.number, r.title);
}

// Search within a specific framework
let results = client
    .search
    .query("data breach", Some("gdpr"), None, None, Some(20))
    .await?;

// Filter by result type
let results = client
    .search
    .query("encryption", Some("gdpr"), Some("article"), None, None)
    .await?;

Auto-Paginate Results

use futures::StreamExt;

let mut stream = Box::pin(client.search.iter("vulnerability disclosure", None, None, 20));
while let Some(result) = stream.next().await {
    let r = result?;
    println!("[{}] {}", r.framework_slug, r.title);
}

SearchResult Fields

FieldTypeDescription
idu32Internal ID
framework_slugStringSource framework
result_typeStringarticle, recital, or requirement
numberStringArticle/recital/requirement number
titleStringTitle or first line
snippetOption<String>Matched text excerpt
scoref64Relevance score