Skip to content

Commit

Permalink
Fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
schneems committed Jun 3, 2024
1 parent b09ffa2 commit 2e0e0c3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 29 deletions.
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ pub mod state {
/// This state is intended for long-running tasks that do not stream but wish to convey progress
/// to the end user. For example, while downloading a file.
///
/// This state is started from a [`state::SubBullet`] and finished back to a [`state::SubBullet`].
/// This state is started from a [`SubBullet`] and finished back to a [`SubBullet`].
///
/// ```rust
/// use bullet_stream::{Output, state::{Bullet, SubBullet}};
Expand Down Expand Up @@ -277,7 +277,7 @@ where
/// [`Output::error`] instead.
///
/// Warnings will be output in a multi-line paragraph style. A warning can be emitted from any
/// state except for [`state::NotStarted`].
/// state except for [`state::Header`].
#[must_use]
pub fn warning(mut self, s: impl AsRef<str>) -> Output<S> {
self.write_paragraph(&ANSI::Yellow, s);
Expand Down Expand Up @@ -334,7 +334,7 @@ where
{
/// Create a buildpack output struct, but do not announce the buildpack's start.
///
/// See the [`Output::start`] method for more details.
/// See the [`Output::h1`] and [`Output::h2`] methods for more details.
#[must_use]
pub fn new(io: W) -> Self {
Self {
Expand Down Expand Up @@ -478,7 +478,7 @@ where
/// Finalize a timer's output.
///
/// Once you're finished with your long running task, calling this function
/// finalizes the timer's output and transitions back to a [`state::Section`].
/// finalizes the timer's output and transitions back to a [`state::SubBullet`].
#[must_use]
pub fn done(self) -> Output<state::SubBullet<W>> {
let duration = self.state.started.elapsed();
Expand Down Expand Up @@ -531,7 +531,7 @@ where
/// observable by the user through the buildpack output. For example, if a cache needs to be
/// cleared, emit that your buildpack is clearing it and why.
///
/// Multiple steps are allowed within a section. This function returns to the same [`state::Section`].
/// Multiple steps are allowed within a section. This function returns to the same [`state::SubBullet`].
#[must_use]
pub fn sub_bullet(mut self, s: impl AsRef<str>) -> Output<state::SubBullet<W>> {
writeln_now(&mut self.state.write, Self::style(s));
Expand Down
24 changes: 0 additions & 24 deletions src/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ use std::sync::Arc;
/// Constructs a writer that buffers written data until given marker byte is encountered and
/// then applies the given mapping function to the data before passing the result to the wrapped
/// writer.
///
/// See the [`mappers`] module for a collection of commonly used mappers.
pub fn mapped<W: io::Write, F: (Fn(Vec<u8>) -> Vec<u8>) + Sync + Send + 'static>(
w: W,
marker_byte: u8,
Expand All @@ -19,8 +17,6 @@ pub fn mapped<W: io::Write, F: (Fn(Vec<u8>) -> Vec<u8>) + Sync + Send + 'static>
/// Constructs a writer that buffers written data until an ASCII/UTF-8 newline byte (`b'\n'`) is
/// encountered and then applies the given mapping function to the data before passing the result to
/// the wrapped writer.
///
/// See the [`mappers`] module for a collection of commonly used mappers.
pub fn line_mapped<W: io::Write, F: (Fn(Vec<u8>) -> Vec<u8>) + Sync + Send + 'static>(
w: W,
f: F,
Expand All @@ -47,13 +43,6 @@ pub struct MappedWrite<W: io::Write> {
mapping_fn: Arc<dyn (Fn(Vec<u8>) -> Vec<u8>) + Sync + Send>,
}

/// A tee writer that was created with the [`tee`] function.
#[derive(Debug, Clone)]
pub struct TeeWrite<A: io::Write, B: io::Write> {
inner_a: A,
inner_b: B,
}

impl<W> MappedWrite<W>
where
W: io::Write,
Expand Down Expand Up @@ -134,19 +123,6 @@ impl<W: io::Write + Debug> Debug for MappedWrite<W> {
}
}

impl<A: io::Write, B: io::Write> io::Write for TeeWrite<A, B> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
self.inner_a.write_all(buf)?;
self.inner_b.write_all(buf)?;
Ok(buf.len())
}

fn flush(&mut self) -> io::Result<()> {
self.inner_a.flush()?;
self.inner_b.flush()
}
}

#[cfg(test)]
mod test {
use crate::write::line_mapped;
Expand Down

0 comments on commit 2e0e0c3

Please sign in to comment.