format
This commit is contained in:
parent
6c8ee376d9
commit
4df2f252b2
1 changed files with 9 additions and 9 deletions
18
src/data.rs
18
src/data.rs
|
@ -1,5 +1,5 @@
|
||||||
//! Contains tons of structs used by the library
|
//! Contains tons of structs used by the library
|
||||||
//!
|
//!
|
||||||
//! All examples here are based off the [Torznab spec](https://torznab.github.io/spec-1.3-draft/torznab/Specification-v1.3.html)'s `/api?caps` example.
|
//! All examples here are based off the [Torznab spec](https://torznab.github.io/spec-1.3-draft/torznab/Specification-v1.3.html)'s `/api?caps` example.
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
pub(crate) type AuthFunc = fn(String) -> Result<bool, String>;
|
pub(crate) type AuthFunc = fn(String) -> Result<bool, String>;
|
||||||
|
@ -75,7 +75,7 @@ pub struct Subcategory {
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
/// Contains a category, for use in [`Caps`] and searches as a query parameter
|
/// Contains a category, for use in [`Caps`] and searches as a query parameter
|
||||||
///
|
///
|
||||||
/// Example, using `subcat` from the [`Subcategory`] example:
|
/// Example, using `subcat` from the [`Subcategory`] example:
|
||||||
/// ```
|
/// ```
|
||||||
/// let category = Category {
|
/// let category = Category {
|
||||||
|
@ -97,7 +97,7 @@ pub struct Category {
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
/// Contains a genre, for use in [`Caps`] and searches as a query parameter
|
/// Contains a genre, for use in [`Caps`] and searches as a query parameter
|
||||||
///
|
///
|
||||||
/// Example:
|
/// Example:
|
||||||
/// ```
|
/// ```
|
||||||
/// let genre = Genre {
|
/// let genre = Genre {
|
||||||
|
@ -119,9 +119,9 @@ pub struct Genre {
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||||
/// Contains a tag, for use in [`Caps`] and searches as a query parameter
|
/// Contains a tag, for use in [`Caps`] and searches as a query parameter
|
||||||
///
|
///
|
||||||
/// Example:
|
/// Example:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// let tag = Tag {
|
/// let tag = Tag {
|
||||||
/// name: "trusted".to_string(),
|
/// name: "trusted".to_string(),
|
||||||
|
@ -146,7 +146,7 @@ pub struct Tag {
|
||||||
/// ```
|
/// ```
|
||||||
/// let mut info: HashMap<String, String> = HashMap::new();
|
/// let mut info: HashMap<String, String> = HashMap::new();
|
||||||
/// info.insert("version".to_string(), "1.1".to_string());
|
/// info.insert("version".to_string(), "1.1".to_string());
|
||||||
///
|
///
|
||||||
/// let caps_data = Caps {
|
/// let caps_data = Caps {
|
||||||
/// server_info: Some(info),
|
/// server_info: Some(info),
|
||||||
/// limits: query_limits,
|
/// limits: query_limits,
|
||||||
|
@ -177,21 +177,21 @@ pub struct Caps {
|
||||||
/// A struct that holds configuration for torznab-toolkit
|
/// A struct that holds configuration for torznab-toolkit
|
||||||
/// The search function (`/api?t=search`) and capabilities (`/api?t=caps` - struct [`Caps`]) are required
|
/// The search function (`/api?t=search`) and capabilities (`/api?t=caps` - struct [`Caps`]) are required
|
||||||
/// Everything else is optional
|
/// Everything else is optional
|
||||||
///
|
///
|
||||||
/// Example, using other examples:
|
/// Example, using other examples:
|
||||||
/// ```
|
/// ```
|
||||||
/// fn search_func(parameters: SearchParameters) -> Result<Vec<Torrent>, String> {
|
/// fn search_func(parameters: SearchParameters) -> Result<Vec<Torrent>, String> {
|
||||||
/// let torrent = /* see `Torrent` example */
|
/// let torrent = /* see `Torrent` example */
|
||||||
/// return torrent;
|
/// return torrent;
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// fn auth_func(apikey: String) -> Result<bool, String> {
|
/// fn auth_func(apikey: String) -> Result<bool, String> {
|
||||||
/// if apikey == "letmein".to_string() {
|
/// if apikey == "letmein".to_string() {
|
||||||
/// return Ok(true);
|
/// return Ok(true);
|
||||||
/// }
|
/// }
|
||||||
/// return Ok(false);
|
/// return Ok(false);
|
||||||
/// }
|
/// }
|
||||||
///
|
///
|
||||||
/// let conf = Config {
|
/// let conf = Config {
|
||||||
/// search: search,
|
/// search: search,
|
||||||
/// auth: Some(auth),
|
/// auth: Some(auth),
|
||||||
|
|
Loading…
Reference in a new issue