pub struct CompositionContext<'a> { /* private fields */ }
Expand description
Provides access to common utilities, such as methods to lookup other composition tree nodes, or Rng.
This struct is provided as an argument to Renderer::render
.
Implementations§
Source§impl<'a> CompositionContext<'a>
impl<'a> CompositionContext<'a>
Sourcepub fn find<Element>(&self) -> CtxQuery<'_, Element, impl Fn(&Element)>where
Element: Element,
pub fn find<Element>(&self) -> CtxQuery<'_, Element, impl Fn(&Element)>where
Element: Element,
Search the in-progress composition tree for nodes of type Element
.
Returns a CtxQuery
, allowing further specifications before running the search.
Sourcepub fn beat_length(&self) -> i32
pub fn beat_length(&self) -> i32
Returns the composition beat length. A composition’s tempo (BPM) is relative to this value.
Sourcepub fn rng(&self) -> impl Rng
pub fn rng(&self) -> impl Rng
Creates an Rng
seeded from the currently rendering segment’s seed.
Sourcepub fn rng_with_seed(&self, seed: impl Hash) -> impl Rng
pub fn rng_with_seed(&self, seed: impl Hash) -> impl Rng
Creates an Rng
seeded from a combination of the currently rendering segment’s seed
as well as the provided seed.
Trait Implementations§
Source§impl Clone for CompositionContext<'_>
impl Clone for CompositionContext<'_>
Source§fn clone(&self) -> CompositionContext<'_>
fn clone(&self) -> CompositionContext<'_>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'a> Debug for CompositionContext<'a>
impl<'a> Debug for CompositionContext<'a>
impl Copy for CompositionContext<'_>
Auto Trait Implementations§
impl<'a> Freeze for CompositionContext<'a>
impl<'a> !RefUnwindSafe for CompositionContext<'a>
impl<'a> !Send for CompositionContext<'a>
impl<'a> !Sync for CompositionContext<'a>
impl<'a> Unpin for CompositionContext<'a>
impl<'a> !UnwindSafe for CompositionContext<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more