Rename TextWithHistory to SpanWithHistory
This commit is contained in:
parent
ae5940718e
commit
8bd803c9b2
1 changed files with 100 additions and 30 deletions
27
src/types/span_with_history.rs
Normal file
27
src/types/span_with_history.rs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#[cfg(feature = "serde")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "wasm")]
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
use crate::types::history::History;
|
||||
|
||||
/// Wrapper type for `(History, String)`
|
||||
#[cfg_attr(feature = "wasm", wasm_bindgen)]
|
||||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct SpanWithHistory {
|
||||
history: History,
|
||||
text: String,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "wasm", wasm_bindgen)]
|
||||
impl SpanWithHistory {
|
||||
#[must_use]
|
||||
pub fn new(history: History, text: String) -> Self { SpanWithHistory { history, text } }
|
||||
|
||||
#[must_use]
|
||||
pub fn history(&self) -> History { self.history }
|
||||
|
||||
#[must_use]
|
||||
pub fn text(&self) -> String { self.text.clone() }
|
||||
}
|
||||
Loading…
Reference in a new issue