diff options
| author | 2019-11-22 22:14:24 +0100 | |
|---|---|---|
| committer | 2019-11-22 22:14:24 +0100 | |
| commit | 6a0e442ad68c2b104b7e91ef80798610a79aca6b (patch) | |
| tree | 1ed581908a0a45f10f4b58cdc4ce280980a4cce9 /wgpu/src/text | |
| parent | fa227255b02adbbfa99801a7baaa4d6d387f7302 (diff) | |
| download | iced-6a0e442ad68c2b104b7e91ef80798610a79aca6b.tar.gz iced-6a0e442ad68c2b104b7e91ef80798610a79aca6b.tar.bz2 iced-6a0e442ad68c2b104b7e91ef80798610a79aca6b.zip | |
Write docs for `iced_wgpu`
Diffstat (limited to '')
| -rw-r--r-- | wgpu/src/text.rs | 12 | 
1 files changed, 7 insertions, 5 deletions
| diff --git a/wgpu/src/text.rs b/wgpu/src/text.rs index da070f5c..bf37abe5 100644 --- a/wgpu/src/text.rs +++ b/wgpu/src/text.rs @@ -2,8 +2,7 @@ mod font;  use crate::Transformation; -use std::cell::RefCell; -use std::collections::HashMap; +use std::{cell::RefCell, collections::HashMap};  pub const BUILTIN_ICONS: iced_native::Font = iced_native::Font::External {      name: "iced_wgpu icons", @@ -12,6 +11,7 @@ pub const BUILTIN_ICONS: iced_native::Font = iced_native::Font::External {  pub const CHECKMARK_ICON: char = '\u{F00C}'; +#[derive(Debug)]  pub struct Pipeline {      draw_brush: RefCell<wgpu_glyph::GlyphBrush<'static, ()>>,      draw_font_map: RefCell<HashMap<String, wgpu_glyph::FontId>>, @@ -56,7 +56,7 @@ impl Pipeline {          wgpu_glyph::FontId(0)      } -    pub fn queue(&mut self, section: wgpu_glyph::Section) { +    pub fn queue(&mut self, section: wgpu_glyph::Section<'_>) {          self.draw_brush.borrow_mut().queue(section);      } @@ -134,7 +134,8 @@ impl Pipeline {          // it uses a lifetimed `GlyphCalculatorGuard` with side-effects on drop.          // This makes stuff quite inconvenient. A manual method for trimming the          // cache would make our lives easier. -        self.measure_brush +        let _ = self +            .measure_brush              .borrow_mut()              .process_queued(|_, _| {}, |_| {})              .expect("Trim text measurements"); @@ -154,7 +155,8 @@ impl Pipeline {                  let font_id =                      self.draw_brush.borrow_mut().add_font_bytes(bytes); -                self.draw_font_map +                let _ = self +                    .draw_font_map                      .borrow_mut()                      .insert(String::from(name), font_id); | 
