Skip to content

Commit

Permalink
feat: add top-level docs example.
Browse files Browse the repository at this point in the history
This commit adds a top-level example to the crate docs, and also fixes
a broken link in the docs for ObjectType.

Signed-off-by: Andrew Lilley Brinker <alilleybrinker@gmail.com>
  • Loading branch information
alilleybrinker committed Feb 19, 2024
1 parent c966d56 commit 65e2f77
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions gitoid/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,18 @@
//! the hash algorithm used and the object type being identified. These are
//! defined by the [`HashAlgorithm`] and [`ObjectType`] traits.
//!
//! ## Example
//!
//! ```rust
//! # use gitoid::{Sha256, Blob};
//!
//! type GitOid = gitoid::GitOid<Sha256, Blob>;
//!
//! let gitoid: GitOid = gitoid::GitOid::from_str("hello, world");
//!
//! println!("gitoid: {}", gitoid);
//! ```
//!
//! [gitoid]: https://git-scm.com/book/en/v2/Git-Internals-Git-Objects
//! [omnibor]: https://omnibor.io
Expand Down
2 changes: 2 additions & 0 deletions gitoid/src/object_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use crate::GitOid;
///
/// For more information on sealed traits, read Predrag
/// Gruevski's ["A Definitive Guide to Sealed Traits in Rust"][1].
///
/// [1]: https://predr.ag/blog/definitive-guide-to-sealed-traits-in-rust/
pub trait ObjectType: Sealed {
#[doc(hidden)]
const NAME: &'static str;
Expand Down

0 comments on commit 65e2f77

Please sign in to comment.