pub struct PixelSize {
pub width: u32,
pub height: u32,
}Fields§
§width: u32§height: u32Implementations§
Source§impl PixelSize
impl PixelSize
pub const ZERO: Self
Sourcepub const fn new(width: u32, height: u32) -> Self
pub const fn new(width: u32, height: u32) -> Self
Examples found in repository?
examples/native_wgpu_host.rs (line 37)
30fn main() -> Result<(), Box<dyn Error>> {
31 #[cfg(all(feature = "wgpu", feature = "native-window"))]
32 if std::env::var_os("OPERAD_RUN_WGPU_EXAMPLE_WINDOW").is_some() {
33 return run_windowed_wgpu_example();
34 }
35
36 let viewport = UiSize::new(640.0, 360.0);
37 let frame = sample_frame(viewport, RenderTarget::offscreen(PixelSize::new(640, 360)))?;
38
39 println!(
40 "native_wgpu_host: {} paint items, {} accessibility nodes",
41 frame.render_request.paint.items.len(),
42 frame.accessibility_tree.nodes.len()
43 );
44
45 #[cfg(feature = "wgpu")]
46 if std::env::var_os("OPERAD_RUN_WGPU_EXAMPLE").is_some() {
47 let mut renderer = WgpuRenderer::new();
48 let output = renderer.render_frame(frame.render_request, &EmptyResourceResolver)?;
49 println!(
50 "native_wgpu_host: rendered {} items into {:?}",
51 output.painted_items, output.target
52 );
53 }
54
55 Ok(())
56}Trait Implementations§
impl Copy for PixelSize
impl Eq for PixelSize
impl StructuralPartialEq for PixelSize
Auto Trait Implementations§
impl Freeze for PixelSize
impl RefUnwindSafe for PixelSize
impl Send for PixelSize
impl Sync for PixelSize
impl Unpin for PixelSize
impl UnsafeUnpin for PixelSize
impl UnwindSafe for PixelSize
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
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>
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)
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)
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
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.