Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jan 14, 2023
1 parent c5866df commit 668963d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
2 changes: 2 additions & 0 deletions src/alerts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ use crate::Sodg;
use anyhow::anyhow;
use anyhow::Result;

/// An function that is called when a problem is found in [`Sodg`].
///
/// Instances of this type can be used in [`Sodg::alert_on`] method,
/// in order to ensure runtime consistency of data inside the graph.
pub type Alert = fn(g: &Sodg, vx: Vec<u32>) -> Vec<String>;
Expand Down
1 change: 0 additions & 1 deletion src/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ fn collects_complicated_graph() -> Result<()> {
for i in 1..=5 {
g.data(i)?;
}
// g.collect(1)?;
assert!(g.is_empty());
Ok(())
}
2 changes: 1 addition & 1 deletion src/hex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use anyhow::{Context, Result};
use std::fmt::{Debug, Display, Formatter};
use std::str::FromStr;

/// It is an object-oriented representation of binary data
/// An object-oriented representation of binary data
/// in hexadecimal format, which can be put into vertices of the graph.
///
/// You can create it from Rust primitives:
Expand Down
12 changes: 7 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
//! modifications comping from a user (through [`Sodg::add`],
//! [`Sodg::bind`], and [`Sodg::put`]) and then decides itself when
//! it's time to delete some vertices (something similar to
//! "garbage collection"). For example, here is how you create a simple
//! graph with two vertices and an edge between them:
//! "garbage collection").
//!
//! For example, here is how you create a simple
//! di-graph with two vertices and an edge between them:
//!
//! ```
//! use sodg::Sodg;
Expand Down Expand Up @@ -65,7 +67,7 @@ pub use crate::hex::Hex;
pub use crate::script::Script;
pub(crate) use crate::vertex::Vertex;

/// This struct represents a Surging Object DiGraph (SODG).
/// A struct that represents a Surging Object DiGraph (SODG).
///
/// You add vertices to it, bind them one to one with edges,
/// put data into some of them, and read data back:
Expand Down Expand Up @@ -110,12 +112,12 @@ pub trait Relay {
fn re(&self, v: u32, a: &str, b: &str) -> Result<String>;
}

/// This `Relay` doesn't even try to find anything, but returns an error.
/// A [`Relay`] that doesn't even try to find anything, but returns an error.
///
/// If you don't know what relay to use, use [`DeadRelay::new()`].
pub struct DeadRelay {}

/// This `Relay` can be made of a lambda function.
/// A [`Relay`] that is made of a lambda function.
///
/// The function must accept three arguments: `v` is the ID of the vertex where an attribute
/// is not found, `a` is the name of the attribute, `b` is the optional locator
Expand Down
6 changes: 4 additions & 2 deletions src/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ use regex::Regex;
use std::collections::HashMap;
use std::str::FromStr;

/// It is a wrapper of a plain text with graph-modifying
/// instructions, for example:
/// A wrapper of a plain text with graph-modifying
/// instructions.
///
/// For example, you can pass the following instructions to it:
///
/// ```text
/// ADD(0);
Expand Down

0 comments on commit 668963d

Please sign in to comment.