From 0d0a5714f577590644bad8aa125d9b23f6beca2a Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Thu, 28 Apr 2016 10:16:55 +0200 Subject: [PATCH] Add better docs to BufferSlice --- vulkano/src/buffer/mod.rs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/vulkano/src/buffer/mod.rs b/vulkano/src/buffer/mod.rs index c7d34cf2..d30fe70d 100644 --- a/vulkano/src/buffer/mod.rs +++ b/vulkano/src/buffer/mod.rs @@ -77,12 +77,27 @@ pub mod view; /// A subpart of a buffer. /// -/// This object doesn't correspond to any Vulkan object. It exists for the programmer's -/// convenience. +/// This object doesn't correspond to any Vulkan object. It exists for API convenience. /// /// # Example /// -/// TODO: example +/// Creating a slice: +/// +/// ```no_run +/// use vulkano::buffer::BufferSlice; +/// # let buffer: std::sync::Arc> = +/// unsafe { std::mem::uninitialized() }; +/// let _slice = BufferSlice::from(&buffer); +/// ``` +/// +/// Selecting a slice of a buffer that contains `[T]`: +/// +/// ```no_run +/// use vulkano::buffer::BufferSlice; +/// # let buffer: std::sync::Arc> = +/// unsafe { std::mem::uninitialized() }; +/// let _slice = BufferSlice::from(&buffer).slice(12 .. 14).unwrap(); +/// ``` /// #[derive(Clone)] pub struct BufferSlice<'a, T: ?Sized, B: 'a> {