From 1dd829a8ed4a30641e1bb5989a06c119969875ec Mon Sep 17 00:00:00 2001 From: shivshank Date: Sun, 21 Apr 2019 21:40:30 -0400 Subject: [PATCH] Fix doc tests --- src/config.rs | 8 +++++--- src/lib.rs | 11 +++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/config.rs b/src/config.rs index d3803cf..d44bc3e 100644 --- a/src/config.rs +++ b/src/config.rs @@ -2,13 +2,15 @@ /// /// The following pattern is reccomended when creating a config: /// -/// ```rust -/// let config = Config { +/// ``` +/// use mini_gl_fb::Config; +/// +/// let config: Config<&str> = Config { /// /* specify whichever fields you need to set, for example: */ /// window_size: (100.0, 100.0), /// resizable: false, /// .. Default::default() -/// } +/// }; /// ``` /// /// If there's a config option you want to see or think is missing, please open an issue! diff --git a/src/lib.rs b/src/lib.rs index 9e9543b..50e495a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -39,6 +39,11 @@ //! you to, for instance, create a window with a buffer of a different size than the window. //! //! ```rust +//! use mini_gl_fb::{get_fancy, Config}; +//! # let window_title = "foo"; +//! # let window_width = 800.0; +//! # let window_height = 600.0; +//! //! let config = Config { //! window_title: window_title.to_string(), //! window_size: (window_width, window_height), @@ -199,6 +204,8 @@ impl MiniGlFb { /// The behavior of the default fragment shader can be emulated by the following: /// /// ```rust + /// # use mini_gl_fb::get_fancy; + /// # let mut fb = get_fancy::<&str>(Default::default()); /// fb.use_post_process_shader(" /// void main_image( out vec4 r_frag_color, in vec2 v_uv ) { /// r_frag_color = texture(u_buffer, v_uv); @@ -242,6 +249,10 @@ impl MiniGlFb { /// # Example /// /// ```rust + /// use mini_gl_fb::BufferFormat; + /// # use mini_gl_fb::get_fancy; + /// # let mut fb = get_fancy::<&str>(Default::default()); + /// /// fb.change_buffer_format::(BufferFormat::R); /// fb.use_grayscale_shader(); /// ```