Skip to content

Commit

Permalink
rustfmt docs
Browse files Browse the repository at this point in the history
  • Loading branch information
alexheretic committed Nov 3, 2022
1 parent 27b9fef commit 39a1673
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 24 deletions.
2 changes: 1 addition & 1 deletion draw-cache/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
//! # let glyph: ab_glyph::Glyph = unimplemented!();
//! match draw_cache.rect_for(font_id, &glyph) {
//! Some((tex_coords, px_coords)) => {}
//! None => {/* The glyph has no outline, or wasn't queued up to be cached */}
//! None => { /* The glyph has no outline, or wasn't queued up to be cached */ }
//! }
//! # Ok(()) }
//! ```
Expand Down
12 changes: 5 additions & 7 deletions gfx-glyph/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,8 @@ where
/// ```no_run
/// # use gfx_glyph::GlyphBrushBuilder;
/// # let some_font: gfx_glyph::ab_glyph::FontArc = unimplemented!();
/// GlyphBrushBuilder::using_font(some_font)
/// .depth_test(gfx::preset::depth::PASS_WRITE)
/// // ...
/// GlyphBrushBuilder::using_font(some_font).depth_test(gfx::preset::depth::PASS_WRITE)
/// // ...
/// # ;
/// ```
pub fn depth_test(mut self, depth_test: gfx::state::Depth) -> Self {
Expand All @@ -104,7 +103,7 @@ where
/// # let some_font: gfx_glyph::ab_glyph::FontArc = unimplemented!();
/// GlyphBrushBuilder::using_font(some_font)
/// .texture_filter_method(gfx::texture::FilterMethod::Scale)
/// // ...
/// // ...
/// # ;
/// ```
pub fn texture_filter_method(mut self, filter_method: texture::FilterMethod) -> Self {
Expand All @@ -124,9 +123,8 @@ where
/// # use gfx_glyph::GlyphBrushBuilder;
/// # let some_font: gfx_glyph::ab_glyph::FontArc = unimplemented!();
/// # type SomeOtherBuildHasher = std::collections::hash_map::RandomState;
/// GlyphBrushBuilder::using_font(some_font)
/// .section_hasher(SomeOtherBuildHasher::default())
/// // ...
/// GlyphBrushBuilder::using_font(some_font).section_hasher(SomeOtherBuildHasher::default())
/// // ...
/// # ;
/// ```
pub fn section_hasher<T: BuildHasher>(self, section_hasher: T) -> GlyphBrushBuilder<F, T> {
Expand Down
11 changes: 5 additions & 6 deletions gfx-glyph/src/draw_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,7 @@ where
/// # let font: gfx_glyph::ab_glyph::FontArc = unimplemented!();
/// # let mut glyph_brush = gfx_glyph::GlyphBrushBuilder::using_font(font)
/// # .build(gfx_factory.clone());
/// glyph_brush
/// .use_queue()
/// .draw(&mut gfx_encoder, &gfx_color)?;
/// glyph_brush.use_queue().draw(&mut gfx_encoder, &gfx_color)?;
/// # Ok(())
/// # }
/// ```
Expand All @@ -191,9 +189,10 @@ where
/// # let mut glyph_brush = gfx_glyph::GlyphBrushBuilder::using_font(font)
/// # .build(gfx_factory.clone());
/// # let raw_render_view = gfx_color.raw();
/// glyph_brush
/// .use_queue()
/// .draw(&mut gfx_encoder, &(raw_render_view, format::Srgba8::get_format()))?;
/// glyph_brush.use_queue().draw(
/// &mut gfx_encoder,
/// &(raw_render_view, format::Srgba8::get_format()),
/// )?;
/// # Ok(())
/// # }
/// ```
Expand Down
3 changes: 1 addition & 2 deletions gfx-glyph/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
//! let mut glyph_brush = GlyphBrushBuilder::using_font(dejavu).build(gfx_factory.clone());
//!
//! # let some_other_section = Section::default();
//! let section = Section::default()
//! .add_text(Text::new("Hello gfx_glyph"));
//! let section = Section::default().add_text(Text::new("Hello gfx_glyph"));
//!
//! glyph_brush.queue(section);
//! glyph_brush.queue(some_other_section);
Expand Down
3 changes: 1 addition & 2 deletions glyph-brush/src/glyph_brush/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ use std::hash::BuildHasher;
/// # type Vertex = ();
///
/// let dejavu = FontArc::try_from_slice(include_bytes!("../../../fonts/DejaVuSans.ttf")).unwrap();
/// let mut glyph_brush: GlyphBrush<Vertex> =
/// GlyphBrushBuilder::using_font(dejavu).build();
/// let mut glyph_brush: GlyphBrush<Vertex> = GlyphBrushBuilder::using_font(dejavu).build();
/// ```
#[non_exhaustive]
pub struct GlyphBrushBuilder<F = FontArc, H = DefaultSectionHasher> {
Expand Down
3 changes: 1 addition & 2 deletions glyph-brush/src/glyph_calculator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ pub trait GlyphCruncher<F: Font = FontArc, X: Clone = Extra> {
/// let dejavu = FontArc::try_from_slice(include_bytes!("../../fonts/DejaVuSans.ttf")).unwrap();
/// let glyphs = GlyphCalculatorBuilder::using_font(dejavu).build();
///
/// let section = Section::default()
/// .add_text(Text::new("Hello glyph_brush"));
/// let section = Section::default().add_text(Text::new("Hello glyph_brush"));
///
/// // create the scope, equivalent to a lock on the cache when
/// // dropped will clean unused cached calculations like a draw call
Expand Down
4 changes: 3 additions & 1 deletion glyph-brush/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! ```
//! use glyph_brush::{ab_glyph::FontArc, BrushAction, BrushError, GlyphBrushBuilder, Section, Text};
//! use glyph_brush::{
//! ab_glyph::FontArc, BrushAction, BrushError, GlyphBrushBuilder, Section, Text,
//! };
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let dejavu = FontArc::try_from_slice(include_bytes!("../../fonts/DejaVuSans.ttf"))?;
Expand Down
2 changes: 1 addition & 1 deletion glyph-brush/src/section.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub type Color = [f32; 4];
///
/// # Example
/// ```
/// use glyph_brush::{HorizontalAlign, Layout, Text, Section};
/// use glyph_brush::{HorizontalAlign, Layout, Section, Text};
///
/// let section = Section::default()
/// .add_text(Text::new("The last word was ").with_color([0.0, 0.0, 0.0, 1.0]))
Expand Down
14 changes: 12 additions & 2 deletions layout/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,23 @@
//!
//! assert_eq!(glyphs.len(), 24);
//!
//! let SectionGlyph { glyph, font_id, section_index, byte_index } = &glyphs[4];
//! let SectionGlyph {
//! glyph,
//! font_id,
//! section_index,
//! byte_index,
//! } = &glyphs[4];
//! assert_eq!(glyph.id, fonts[0].glyph_id('o'));
//! assert_eq!(*font_id, FontId(0));
//! assert_eq!(*section_index, 0);
//! assert_eq!(*byte_index, 4);
//!
//! let SectionGlyph { glyph, font_id, section_index, byte_index } = &glyphs[14];
//! let SectionGlyph {
//! glyph,
//! font_id,
//! section_index,
//! byte_index,
//! } = &glyphs[14];
//! assert_eq!(glyph.id, fonts[1].glyph_id('u'));
//! assert_eq!(*font_id, FontId(1));
//! assert_eq!(*section_index, 1);
Expand Down

0 comments on commit 39a1673

Please sign in to comment.