tessera_ui_basic_components/pipelines/text/
command.rs1use tessera_ui::DrawCommand;
2
3use super::TextData;
4
5#[derive(Debug, Clone, PartialEq)]
6pub struct TextCommand {
7 pub data: TextData,
8}
9
10impl DrawCommand for TextCommand {
11 fn barrier(&self) -> Option<tessera_ui::BarrierRequirement> {
12 None
14 }
15}
16
17#[derive(Debug, PartialEq, Clone)]
19pub struct TextConstraint {
20 pub max_width: Option<f32>,
23 pub max_height: Option<f32>,
26}
27
28impl std::hash::Hash for TextConstraint {
29 fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
30 if let Some(w) = self.max_width {
31 w.to_bits().hash(state);
32 } else {
33 0u32.hash(state); }
35 if let Some(h) = self.max_height {
36 h.to_bits().hash(state);
37 } else {
38 0u32.hash(state); }
40 }
41}
42
43impl TextConstraint {
44 pub const NONE: Self = Self {
46 max_width: None,
47 max_height: None,
48 };
49}