Module resource

Module resource 

Source
Expand description

Resource abstraction and configuration for the learner library.

This module provides the core abstractions for working with different types of academic and research resources. It defines:

  • A Resource trait that all resource types must implement
  • A flexible ResourceConfig for runtime-configured resource types
  • Common utility types and functions for resource management

The design allows for both statically defined resource types (like papers and books) and dynamically configured resources that can be defined through configuration files.

§Examples

use learner::{
  resource::{Paper, Resource, ResourceConfig},
  Learner,
};
use serde_json::json;

// Using a built-in resource type
let learner = Learner::builder().build().await?;
let paper = learner.retriever.get_paper("2301.07041").await?;

// Access resource fields
let fields = paper.fields()?;
println!("Paper type: {}", paper.resource_type());

// Or create a custom resource type at runtime
let mut fields = serde_json::Map::new();
fields.insert("title".into(), json!("My Thesis"));
fields.insert("university".into(), json!("Tech University"));

let thesis = ResourceConfig { type_name: "thesis".to_string(), fields };

Structs§

Author
Author information for academic papers.
Paper
Complete representation of an academic paper with metadata.
ResourceConfig
A dynamically configured resource type.

Traits§

Resource
Core trait that defines the behavior of a resource in the system.