Skip to main content

VisualWorld

Struct VisualWorld 

Source
pub struct VisualWorld { /* private fields */ }

Implementations§

Source§

impl VisualWorld

Source

pub fn instance(&self, handle: InstanceHandle) -> Option<&VisualInstance>

Source

pub fn skin(&self, id: SkinId) -> Option<&Skin>

Examples found in repository?
examples/vtuber-joints-example.rs (line 452)
422fn debug_print_selected_joint_influence(
423    universe: &engine::Universe,
424    mesh_key: &str,
425    model_root: engine::ecs::ComponentId,
426    selected: &[(usize, engine::ecs::ComponentId)],
427) {
428    let Some(renderable) = find_renderable_by_mesh_key(&universe.world, model_root, mesh_key)
429    else {
430        println!(
431            "[vtuber-joints-example] influence: mesh_key='{}' renderable not found",
432            mesh_key
433        );
434        return;
435    };
436
437    let renderable_handle = universe
438        .world
439        .get_component_by_id_as::<RenderableComponent>(renderable)
440        .and_then(|r| r.get_handle());
441    println!(
442        "[vtuber-joints-example] influence: mesh_key='{}' renderable={:?} instance_handle={:?}",
443        mesh_key, renderable, renderable_handle
444    );
445    let Some(skin_id) = find_skin_id_for_renderable(&universe.world, renderable) else {
446        println!(
447            "[vtuber-joints-example] influence: mesh_key='{}' has no skin_id",
448            mesh_key
449        );
450        return;
451    };
452    let Some(skin) = universe.visuals.skin(skin_id) else {
453        println!(
454            "[vtuber-joints-example] influence: skin_id={:?} missing in visuals",
455            skin_id
456        );
457        return;
458    };
459    let Some(cpu_h) = universe.render_assets.imported_mesh(mesh_key) else {
460        println!(
461            "[vtuber-joints-example] influence: mesh_key='{}' missing in RenderAssets (did meshes register?)",
462            mesh_key
463        );
464        return;
465    };
466    let Some(cpu) = universe.render_assets.cpu_mesh(cpu_h) else {
467        println!(
468            "[vtuber-joints-example] influence: mesh_key='{}' cpu mesh handle invalid",
469            mesh_key
470        );
471        return;
472    };
473    let (Some(joints0), Some(weights0)) = (cpu.joints0.as_ref(), cpu.weights0.as_ref()) else {
474        println!(
475            "[vtuber-joints-example] influence: mesh_key='{}' has no skin attributes",
476            mesh_key
477        );
478        return;
479    };
480
481    let joint_count = skin.joint_count();
482    let totals = compute_total_weight_per_joint(joints0, weights0, joint_count);
483
484    println!(
485        "[vtuber-joints-example] influence: mesh_key='{}' verts={} joints={}",
486        mesh_key,
487        cpu.vertices.len(),
488        joint_count
489    );
490
491    for &(node_index, joint_tx) in selected.iter() {
492        // Find the skin joint index that maps to this node.
493        let skin_joint_index = skin
494            .joint_node_indices
495            .iter()
496            .position(|&ni| ni == node_index);
497
498        let name = universe
499            .world
500            .get_component_record(joint_tx)
501            .map(|r| r.name.as_str())
502            .unwrap_or("<unknown>");
503
504        match skin_joint_index {
505            Some(j) => {
506                let total = totals.get(j).copied().unwrap_or(0.0);
507                println!(
508                    "  influence: name='{}' node_index={} skin_joint_index={} total_weight={:.3}",
509                    name, node_index, j, total
510                );
511            }
512            None => {
513                println!(
514                    "  influence: name='{}' node_index={} skin_joint_index=<none>",
515                    name, node_index
516                );
517            }
518        }
519    }
520}
521
522fn compute_total_weight_per_joint(
523    joints0: &[[u16; 4]],
524    weights0: &[[f32; 4]],
525    joint_count: usize,
526) -> Vec<f32> {
527    let mut totals = vec![0.0f32; joint_count];
528    if joint_count == 0 {
529        return totals;
530    }
531    for (jv, wv) in joints0.iter().zip(weights0.iter()) {
532        for lane in 0..4 {
533            let j = jv[lane] as usize;
534            if j >= joint_count {
535                continue;
536            }
537            let w = wv[lane];
538            if w > 0.0 {
539                totals[j] += w;
540            }
541        }
542    }
543    totals
544}
545
546fn select_body_prim0_influencers(
547    universe: &engine::Universe,
548    model_root: engine::ecs::ComponentId,
549    mesh_key: &str,
550    count: usize,
551    node_index_to_transform: &HashMap<usize, engine::ecs::ComponentId>,
552) -> Option<Vec<(usize, engine::ecs::ComponentId)>> {
553    if count == 0 {
554        return Some(Vec::new());
555    }
556
557    let renderable = find_renderable_by_mesh_key(&universe.world, model_root, mesh_key)?;
558    let skin_id = find_skin_id_for_renderable(&universe.world, renderable)?;
559    let skin = universe.visuals.skin(skin_id)?;
560
561    let cpu_h = universe.render_assets.imported_mesh(mesh_key)?;
562    let cpu = universe.render_assets.cpu_mesh(cpu_h)?;
563    let joints0 = cpu.joints0.as_ref()?;
564    let weights0 = cpu.weights0.as_ref()?;
565
566    let joint_count = skin.joint_count();
567    if joint_count == 0 {
568        return None;
569    }
570
571    let mut total_weight_per_joint: Vec<f32> = vec![0.0; joint_count];
572    for (jv, wv) in joints0.iter().zip(weights0.iter()) {
573        for lane in 0..4 {
574            let j = jv[lane] as usize;
575            if j >= joint_count {
576                continue;
577            }
578            let w = wv[lane];
579            if w > 0.0 {
580                total_weight_per_joint[j] += w;
581            }
582        }
583    }
584
585    let mut ranked: Vec<(usize, f32)> =
586        total_weight_per_joint.iter().copied().enumerate().collect();
587    ranked.sort_by(|a, b| b.1.partial_cmp(&a.1).unwrap_or(std::cmp::Ordering::Equal));
588
589    let min_total: f32 = 10.0;
590
591    println!(
592        "[vtuber-joints-example] auto joints for mesh_key='{}': verts={} joint_count={} min_total={}",
593        mesh_key,
594        cpu.vertices.len(),
595        joint_count,
596        min_total
597    );
598
599    let mut out: Vec<(usize, engine::ecs::ComponentId)> = Vec::with_capacity(count);
600    let mut seen: HashSet<engine::ecs::ComponentId> = HashSet::new();
601
602    for (joint_index, total) in ranked.into_iter() {
603        if out.len() >= count {
604            break;
605        }
606        if total < min_total {
607            continue;
608        }
609
610        let node_index = *skin.joint_node_indices.get(joint_index)?;
611        let Some(&joint_tx) = node_index_to_transform.get(&node_index) else {
612            continue;
613        };
614        if !seen.insert(joint_tx) {
615            continue;
616        }
617
618        let name = universe
619            .world
620            .get_component_record(joint_tx)
621            .map(|n| n.name.clone())
622            .unwrap_or_else(|| "<unknown>".to_string());
623
624        println!(
625            "  auto[{:<2}] joint_index={:<3} total_weight={:<10.3} node_index={:<3} name={} tx={:?}",
626            out.len(),
627            joint_index,
628            total,
629            node_index,
630            name,
631            joint_tx
632        );
633
634        out.push((node_index, joint_tx));
635    }
636
637    if out.is_empty() { None } else { Some(out) }
638}
639
640fn find_renderable_by_mesh_key(
641    world: &engine::ecs::World,
642    root: engine::ecs::ComponentId,
643    mesh_key: &str,
644) -> Option<engine::ecs::ComponentId> {
645    let mut stack = vec![root];
646    while let Some(node) = stack.pop() {
647        if let Some(m) = world.get_component_by_id_as::<MeshComponent>(node) {
648            if m.key == mesh_key {
649                return find_parent_renderable(world, node);
650            }
651        }
652        for &ch in world.children_of(node) {
653            stack.push(ch);
654        }
655    }
656    None
657}
658
659fn find_parent_renderable(
660    world: &engine::ecs::World,
661    mut cid: engine::ecs::ComponentId,
662) -> Option<engine::ecs::ComponentId> {
663    while let Some(parent) = world.parent_of(cid) {
664        if world
665            .get_component_by_id_as::<RenderableComponent>(parent)
666            .is_some()
667        {
668            return Some(parent);
669        }
670        cid = parent;
671    }
672    None
673}
674
675fn find_skin_id_for_renderable(
676    world: &engine::ecs::World,
677    renderable: engine::ecs::ComponentId,
678) -> Option<engine::graphics::SkinId> {
679    let mut stack = vec![renderable];
680    while let Some(node) = stack.pop() {
681        if let Some(sm) = world.get_component_by_id_as::<SkinnedMeshComponent>(node) {
682            if let Some(id) = sm.skin_id {
683                return Some(id);
684            }
685        }
686        for &ch in world.children_of(node) {
687            stack.push(ch);
688        }
689    }
690    None
691}
692
693fn collect_joint_transforms(
694    world: &engine::ecs::World,
695    skinned_mesh: &engine::ecs::system::SkinnedMeshSystem,
696    visuals: &engine::graphics::VisualWorld,
697    gltf_component: engine::ecs::ComponentId,
698    root: engine::ecs::ComponentId,
699) -> Vec<(usize, engine::ecs::ComponentId)> {
700    fn find_first_skin_id_in_subtree(
701        world: &engine::ecs::World,
702        root: engine::ecs::ComponentId,
703    ) -> Option<engine::graphics::SkinId> {
704        let mut stack = vec![root];
705        while let Some(node) = stack.pop() {
706            if let Some(sm) = world.get_component_by_id_as::<SkinnedMeshComponent>(node) {
707                if let Some(id) = sm.skin_id {
708                    return Some(id);
709                }
710            }
711            for &ch in world.children_of(node) {
712                stack.push(ch);
713            }
714        }
715        None
716    }
717
718    let Some(skin_id) = find_first_skin_id_in_subtree(world, root) else {
719        return Vec::new();
720    };
721    let Some(skin) = visuals.skin(skin_id) else {
722        return Vec::new();
723    };
724    let Some(joints) = skinned_mesh.instance_joints_for_skin(gltf_component, skin_id) else {
725        return Vec::new();
726    };
727
728    let joint_count = skin.joint_count().min(joints.len());
729    let mut out: Vec<(usize, engine::ecs::ComponentId)> = Vec::with_capacity(joint_count);
730    for i in 0..joint_count {
731        let Some(joint_tx) = joints[i] else {
732            continue;
733        };
734        let node_index = skin.joint_node_indices[i];
735        out.push((node_index, joint_tx));
736    }
737
738    out
739}
Source

pub fn skin_id_for(&self, uri: &str, skin_index: usize) -> Option<SkinId>

Source

pub fn upsert_skin( &mut self, uri: &str, skin_index: usize, joint_node_indices: Vec<usize>, inverse_bind_matrices: Vec<TransformMatrix>, ) -> SkinId

Source

pub fn set_skin_matrices( &mut self, handle: InstanceHandle, bones: &[TransformMatrix], ) -> bool

Assigns the skin matrices for an instance into the shared palette.

This keeps bones_base stable for an instance unless its bone count changes.

Source

pub fn bones_palette(&self) -> &[TransformMatrix]

Source

pub fn take_bones_palette_dirty(&mut self) -> bool

Returns whether the bones palette changed since the last call, and clears the dirty flag.

Source

pub fn update_skin_range( &mut self, handle: InstanceHandle, bones_base: u32, bones_count: u32, ) -> bool

Compatibility helper: updates the skin palette range for an instance.

Prefer set_skin_matrices() for stable allocation.

Source§

impl VisualWorld

Source

pub fn new() -> Self

Source

pub fn clear_color(&self) -> [f32; 4]

Source

pub fn set_clear_color(&mut self, rgba: [f32; 4])

Source

pub fn renderer_msaa_mode(&self) -> MsaaMode

Source

pub fn set_renderer_msaa_mode(&mut self, mode: MsaaMode)

Source

pub fn preferred_window_size(&self) -> Option<[u32; 2]>

Source

pub fn set_preferred_window_size(&mut self, size: Option<[u32; 2]>)

Source

pub fn take_preferred_window_size(&mut self) -> Option<[u32; 2]>

Source

pub fn window_frame_dt_sec(&self) -> f32

Source

pub fn window_frame_fps(&self) -> f32

Source

pub fn set_window_frame_dt_sec(&mut self, dt_sec: f32)

Source

pub fn xr_frame_dt_sec(&self) -> Option<f32>

Source

pub fn xr_frame_fps(&self) -> Option<f32>

Source

pub fn set_xr_frame_dt_sec(&mut self, dt_sec: Option<f32>)

Source

pub fn ambient_light(&self) -> [f32; 3]

Source

pub fn set_ambient_light(&mut self, rgb: [f32; 3])

Source

pub fn clear(&mut self)

Source

pub fn active_xr_camera(&self) -> Option<ComponentId>

Source

pub fn set_active_xr_camera(&mut self, component: Option<ComponentId>)

Source

pub fn lights_dirty(&self) -> bool

Source

pub fn take_lights_dirty(&mut self) -> bool

Source

pub fn point_lights(&self) -> &[VisualPointLight]

Source

pub fn upsert_point_light(&mut self, cid: ComponentId, light: VisualPointLight)

Source

pub fn camera_dirty(&self) -> bool

Source

pub fn take_camera_dirty(&mut self) -> bool

Source

pub fn visual_cameras(&self) -> &[VisualCamera]

Source

pub fn visual_camera(&self, target: CameraTarget) -> Option<&VisualCamera>

Source

pub fn camera_view(&self) -> [[f32; 4]; 4]

Window-facing compatibility: returns the first eye’s view matrix for the window target.

Source

pub fn camera_proj(&self) -> [[f32; 4]; 4]

Window-facing compatibility: returns the first eye’s projection matrix for the window target.

Source

pub fn camera_view_for(&self, target: CameraTarget) -> [[f32; 4]; 4]

Source

pub fn camera_view_for_eye( &self, target: CameraTarget, eye: usize, ) -> [[f32; 4]; 4]

Source

pub fn camera_proj_for(&self, target: CameraTarget) -> [[f32; 4]; 4]

Source

pub fn camera_proj_for_eye( &self, target: CameraTarget, eye: usize, ) -> [[f32; 4]; 4]

Source

pub fn viewport(&self) -> [f32; 2]

Source

pub fn set_viewport(&mut self, viewport: [f32; 2])

Source

pub fn camera_2d(&self) -> [[f32; 4]; 3]

Source

pub fn set_camera(&mut self, view: [[f32; 4]; 4], proj: [[f32; 4]; 4])

Source

pub fn set_camera_for_target( &mut self, target: CameraTarget, eyes: Vec<CameraData>, )

Set all eyes for a target.

  • For CameraTarget::Window, pass a 1-element eyes vector.
  • For CameraTarget::Xr, pass 2 (or more) eyes.
Source

pub fn set_camera_mono_for_target( &mut self, target: CameraTarget, view: [[f32; 4]; 4], proj: [[f32; 4]; 4], )

Convenience: set a single-eye camera for a target.

Source

pub fn set_camera_mono_for_target_with_transform( &mut self, target: CameraTarget, view: [[f32; 4]; 4], proj: [[f32; 4]; 4], transform: Transform, )

Source

pub fn set_xr_camera(&mut self, eyes: Vec<CameraData>)

Convenience: set XR eyes.

Source

pub fn set_camera_2d(&mut self, m: [[f32; 4]; 3])

Source

pub fn register_mirror(&mut self, mirror: VisualMirror)

Source

pub fn clear_mirrors(&mut self)

Source

pub fn mirrors(&self) -> &[VisualMirror]

Source

pub fn mirror_texture_key_for_view( &self, mirror_component: ComponentId, family: MirrorViewerFamily, view_index: usize, ) -> Option<&str>

Source

pub fn mirror_count(&self) -> usize

Source

pub fn instance_data_dirty(&self) -> bool

Returns whether any per-instance data has changed since the last time it was consumed.

Source

pub fn take_instance_data_dirty(&mut self) -> bool

Consume the instance-data dirty flag.

Source

pub fn instances(&self) -> &[VisualInstance]

Source

pub fn instance_count(&self) -> usize

Source

pub fn background_order(&self) -> &[u32]

Indices into instances() in the order they should be drawn (opaque batching).

Source

pub fn background_batches(&self) -> &[DrawBatch]

Source

pub fn background_occluded_lit_order(&self) -> &[u32]

Source

pub fn background_occluded_lit_batches(&self) -> &[DrawBatch]

Source

pub fn background_occluded_lit_emissive_order(&self) -> &[u32]

Source

pub fn background_occluded_lit_emissive_batches(&self) -> &[DrawBatch]

Source

pub fn has_background_occluded_lit_emissive(&self) -> bool

Source

pub fn draw_order(&self) -> &[u32]

Indices into instances() in the order they should be drawn (opaque batching).

Source

pub fn draw_batches(&self) -> &[DrawBatch]

Source

pub fn emissive_draw_order(&self) -> &[u32]

Indices into instances() in the order they should be drawn (emissive opaque batching).

Source

pub fn emissive_draw_batches(&self) -> &[DrawBatch]

Source

pub fn cutout_order(&self) -> &[u32]

Indices into instances() in the order they should be drawn (alpha-to-coverage cutout pass).

Source

pub fn cutout_batches(&self) -> &[DrawBatch]

Source

pub fn cutout_stream(&self) -> (&[RenderOp], &[u32])

DFS-ordered render stream for the alpha-to-coverage cutout phase.

Source

pub fn cutout_stream_excluding( &self, excluded_instance: Option<InstanceHandle>, ) -> (Vec<RenderOp>, Vec<u32>)

Source

pub fn emissive_cutout_order(&self) -> &[u32]

Indices into instances() in the order they should be drawn (emissive cutout batching).

Source

pub fn emissive_cutout_batches(&self) -> &[DrawBatch]

Source

pub fn overlay_order(&self) -> &[u32]

Indices into instances() in the order they should be drawn (overlay pass).

Source

pub fn overlay_batches(&self) -> &[DrawBatch]

Source

pub fn transparent_single_stream(&self) -> (&[RenderOp], &[u32])

DFS-ordered render stream for the single-layer transparent phase.

Source

pub fn transparent_single_stream_excluding( &self, excluded_instance: Option<InstanceHandle>, ) -> (Vec<RenderOp>, Vec<u32>)

Source

pub fn overlay_stream(&self) -> (&[RenderOp], &[u32])

DFS-ordered render stream for the overlay phase.

Returns (ops, instance_indices).

  • ops is the sequence of EnterClip, DrawBatch, and ExitClip commands.
  • instance_indices[batch.start .. batch.start + batch.count] gives the VisualInstance indices for each DrawBatch op.
Source

pub fn overlay_stream_excluding( &self, excluded_instance: Option<InstanceHandle>, ) -> (Vec<RenderOp>, Vec<u32>)

Source

pub fn opaque_stream(&self) -> (&[RenderOp], &[u32])

DFS-ordered render stream for the opaque phase.

Returns (ops, instance_indices).

Source

pub fn opaque_stream_excluding( &self, excluded_instance: Option<InstanceHandle>, ) -> (Vec<RenderOp>, Vec<u32>)

Source

pub fn stencil_clip_order(&self) -> &[u32]

Indices into instances() where is_stencil_clip=true, sorted by stencil_ref ascending. Used by the renderer to inject stencil write/restore draws around clipped batch groups.

Source

pub fn register_stencil_clip( &mut self, handle: InstanceHandle, stencil_ref: u8, ) -> bool

Mark an instance as a stencil clip source with the given reference value. Triggers draw cache rebuild.

Source

pub fn unregister_stencil_clip(&mut self, handle: InstanceHandle) -> bool

Remove stencil clip status from an instance.

Source

pub fn update_stencil_ref( &mut self, handle: InstanceHandle, stencil_ref: u8, ) -> bool

Update the stencil reference value for a clipped instance (not the clip source itself).

Source

pub fn transparent_single_draw_order(&self) -> &[u32]

Indices into instances() in the order they should be drawn (single-layer transparent pass).

Source

pub fn transparent_single_draw_batches(&self) -> &[DrawBatch]

Source

pub fn transparent_multi_draw_order(&self) -> &[u32]

Indices into instances() in the order they should be drawn (multi-layer transparent pass).

Source

pub fn transparent_multi_draw_batches(&self) -> &[DrawBatch]

Source

pub fn transparent_multi_draw_excluding( &self, excluded_instance: Option<InstanceHandle>, ) -> (Vec<u32>, Vec<DrawBatch>)

Source

pub fn prepare_draw_cache(&mut self) -> bool

Call once per frame before rendering. Cheap if nothing changed.

Returns true if the cached draw order/batches were rebuilt this call.

Source

pub fn prepare_transparent_multi_draw_cache_for_eye( &mut self, target: CameraTarget, eye: usize, )

Source

pub fn prepare_transparent_multi_draw_cache_for_view( &mut self, view: [[f32; 4]; 4], )

Rebuild multi-layer transparent draw order/batches for a specific view matrix.

Source

pub fn register( &mut self, cid: ComponentId, renderable: GpuRenderable, transform: Transform, color: [f32; 4], opacity: f32, multiple_layers: bool, transparent_cutout: bool, background: bool, background_occluded_lit: bool, overlay: bool, emissive: f32, texture: Option<TextureHandle>, quant_steps: f32, ) -> InstanceHandle

Source

pub fn update_quant_steps( &mut self, handle: InstanceHandle, quant_steps: f32, ) -> bool

Source

pub fn remove(&mut self, handle: InstanceHandle) -> bool

Source

pub fn update_transform( &mut self, handle: InstanceHandle, transform: Transform, ) -> bool

Source

pub fn update_model( &mut self, handle: InstanceHandle, model: TransformMatrix, ) -> bool

Source

pub fn update_color(&mut self, handle: InstanceHandle, color: [f32; 4]) -> bool

Source

pub fn update_opacity(&mut self, handle: InstanceHandle, opacity: f32) -> bool

Source

pub fn update_opacity_state( &mut self, handle: InstanceHandle, opacity: f32, multiple_layers: impl Into<Option<bool>>, ) -> bool

Source

pub fn update_transparent_cutout( &mut self, handle: InstanceHandle, enabled: bool, ) -> bool

Source

pub fn update_emissive(&mut self, handle: InstanceHandle, emissive: f32) -> bool

Source

pub fn update_material( &mut self, handle: InstanceHandle, material: MaterialHandle, ) -> bool

Source

pub fn post_processing(&self) -> &PostProcessingConfig

Source

pub fn post_processing_mut(&mut self) -> &mut PostProcessingConfig

Source

pub fn set_post_processing(&mut self, config: PostProcessingConfig)

Source

pub fn runtime_texture_handle(&self, key: &str) -> Option<TextureHandle>

Source

pub fn stencil_clip_debug_requested(&self) -> bool

Source

pub fn set_stencil_clip_debug_requested(&mut self, requested: bool)

Source

pub fn set_runtime_texture_handle( &mut self, key: impl Into<String>, handle: TextureHandle, )

Source

pub fn update_texture( &mut self, handle: InstanceHandle, texture: Option<TextureHandle>, ) -> bool

Source

pub fn update_texture_filtering( &mut self, handle: InstanceHandle, filtering: TextureFiltering, ) -> bool

Source

pub fn update( &mut self, handle: InstanceHandle, renderable: GpuRenderable, transform: Transform, ) -> bool

Trait Implementations§

Source§

impl Default for VisualWorld

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more