Skip to content

Commit

Permalink
feat: SpinnerActionRunner.title now accepts into<string>
Browse files Browse the repository at this point in the history
  • Loading branch information
Vulpesx committed Apr 30, 2024
1 parent c1563f0 commit e7ee73c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/spinner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,19 @@ impl<'spinner> SpinnerActionRunner<'spinner> {
/// set the spinner style
/// will not compile if ref to style doesn't outlast spinner
pub fn style(
&mut self, // with just this the compiler assumes that style might be stored in self so it wont let u mutate it after this fn call
&mut self, // with just this the compiler assumes that theme might be stored in self so it wont let u mutate it after this fn call
style: &'spinner SpinnerStyle,
) -> Result<(), std::sync::mpsc::SendError<SpinnerAction>> {
let style = unsafe { std::mem::transmute(style) };
self.sender.send(SpinnerAction::Style(style))
}

/// set the spinner title
pub fn title(&self, title: String) -> Result<(), std::sync::mpsc::SendError<SpinnerAction>> {
self.sender.send(SpinnerAction::Title(title))
pub fn title<S: Into<String>>(
&self,
title: S,
) -> Result<(), std::sync::mpsc::SendError<SpinnerAction>> {
self.sender.send(SpinnerAction::Title(title.into()))
}
}

Expand Down

0 comments on commit e7ee73c

Please sign in to comment.