Skip to content

Commit

Permalink
add missing doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
g-s-k committed Jan 20, 2019
1 parent 40e49b7 commit c2054be
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ impl Context {
})
}

/// Get a snapshot of environment state for a list of symbols.
pub fn close(&self, vars: Vec<&str>) -> Env {
let mut out = Env::new();

Expand All @@ -187,6 +188,7 @@ impl Context {
out
}

/// Use definitions from a closure (or purge the existing ones)
pub fn overlay_env(&mut self, env: Option<Env>) {
self.overlay = env;
}
Expand Down
3 changes: 3 additions & 0 deletions src/context/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ use super::Context;
const PREALLOC_BUFFER: usize = 199;

impl Context {
/// Start capturing printed content in a buffer.
pub fn capture(&mut self) {
self.out = Some(String::with_capacity(PREALLOC_BUFFER));
}

/// Capture `display` and `write` statement output in a buffer.
pub fn capturing(mut self) -> Self {
self.capture();
self
}

/// Get the captured side-effect output.
pub fn get_output(&mut self) -> Option<String> {
self.out.take()
}
Expand Down
2 changes: 2 additions & 0 deletions src/sexp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ impl SExp {
}
}

/// Make a basic (pure fuctional) procedure.
pub fn proc<F>(f: F, name: Option<&str>) -> Self
where
F: Fn(Self) -> Result + 'static,
Expand All @@ -148,6 +149,7 @@ impl SExp {
})
}

/// Make a procedure that can mutate or query its execution context.
pub fn ctx_proc<F>(f: F, name: Option<&str>) -> Self
where
F: Fn(Self, &mut Context) -> Result + 'static,
Expand Down

0 comments on commit c2054be

Please sign in to comment.