Skip to content

Commit

Permalink
Add documentation for core::fmt and string_utils (#175)
Browse files Browse the repository at this point in the history
* Add documentation for util and add string_utils tests

* Add documentation to pattern.rs

* Finish documentation for fmt module

* Review fixes
  • Loading branch information
srhickma authored Jun 16, 2019
1 parent 9a72871 commit 9ac0c67
Show file tree
Hide file tree
Showing 5 changed files with 354 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/core/data/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ impl<V: Default> CEHashMap<V> {

/// Inserts a value into the map at the given key.
///
/// # Arguments
/// # Parameters
///
/// * `key` - the key at which to insert the value in the map.
/// * `value` - the value to be inserted into the map.
Expand Down Expand Up @@ -50,7 +50,7 @@ impl<V: Default> CEHashMap<V> {

/// Returns a reference to the value stored in the map at the given key, or `None` if no such value is stored.
///
/// # Arguments
/// # Parameters
///
/// * `key` - the key to look up in the map.
pub fn get(&self, key: usize) -> Option<&V> {
Expand All @@ -62,7 +62,7 @@ impl<V: Default> CEHashMap<V> {

/// Returns a _mutable_ reference to the value stored in the map at the given key, or `None` if no such value is stored.
///
/// # Arguments
/// # Parameters
///
/// * `key` - the key to look up in the map.
pub fn get_mut(&mut self, key: usize) -> Option<&mut V> {
Expand All @@ -74,7 +74,7 @@ impl<V: Default> CEHashMap<V> {

/// Returns `true` if there is a value stored in the map under the given key, and `false` otherwise.
///
/// # Arguments
/// # Parameters
///
/// * `key` - the key to look up in the map.
pub fn contains(&self, key: usize) -> bool {
Expand Down
2 changes: 2 additions & 0 deletions src/core/data/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ use std::{fmt, hash::Hash};

pub mod map;

/// A trait encapsulating some piece of data, with useful requirements for equality, comparison, and debugging.
pub trait Data: PartialEq + Eq + Hash + Clone + fmt::Debug + Send + Sync {
/// Returns a string representation of the data.
fn to_string(&self) -> String;
}

Expand Down
Loading

0 comments on commit 9ac0c67

Please sign in to comment.