1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
//! Encodes the lights, objects, and uniform values needed to draw a single //! frame. /// Holds frame-specific data that is consumed by the frontend. pub struct Frame; impl Frame { /// Creates an empty frame. pub fn new() -> Frame { Frame } /// Creates an initialized frame using the [builder pattern][bp]. /// /// [bp]: https://doc.rust-lang.org/book/method-syntax.html#builder-pattern pub fn build() -> FrameBuilder { FrameBuilder::new() } } /// Consuming builder for easily constructing a new frame. pub struct FrameBuilder { frame: Frame, } impl FrameBuilder { /// Starts building a new frame. pub fn new() -> FrameBuilder { FrameBuilder { frame: Frame::new() } } /// Returns the newly-built frame. pub fn done(self) -> Frame { self.frame } }