Rename TextWithHistory to SpanWithHistory

This commit is contained in:
Andras Schmelczer 2025-07-04 03:14:18 +01:00
commit 8bd803c9b2

View 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() }
}