Struct GlobalCtx
pub struct GlobalCtx<'a> {
pub types: &'a UniqueArena<Type>,
pub constants: &'a Arena<Constant>,
pub overrides: &'a Arena<Override>,
pub global_expressions: &'a Arena<Expression>,
}
Available on crate feature
unstable-wgpu-26
only.Fields§
§types: &'a UniqueArena<Type>
§constants: &'a Arena<Constant>
§overrides: &'a Arena<Override>
§global_expressions: &'a Arena<Expression>
Implementations§
§impl GlobalCtx<'_>
impl GlobalCtx<'_>
pub fn compare_types(&self, lhs: &TypeResolution, rhs: &TypeResolution) -> bool
Trait Implementations§
§impl TypeContext for GlobalCtx<'_>
Format types as WGSL based on a GlobalCtx
.
impl TypeContext for GlobalCtx<'_>
Format types as WGSL based on a GlobalCtx
.
This is probably good enough for diagnostic output, but it has some limitations:
-
It does not apply
Namer
renamings, to avoid collisions. -
It generates invalid WGSL for anonymous struct types.
-
It doesn’t write the lengths of override-expression-sized arrays correctly, unless the expression is just the override identifier.
§fn type_name(&self, handle: Handle<Type>) -> &str
fn type_name(&self, handle: Handle<Type>) -> &str
Return the name to be used for the type referred to by
handle
.§fn write_unnamed_struct<W>(
&self,
_: &TypeInner,
out: &mut W,
) -> Result<(), Error>where
W: Write,
fn write_unnamed_struct<W>(
&self,
_: &TypeInner,
out: &mut W,
) -> Result<(), Error>where
W: Write,
Write a
TypeInner::Struct
for which we are unable to find a name. Read more§fn write_override<W>(
&self,
handle: Handle<Override>,
out: &mut W,
) -> Result<(), Error>where
W: Write,
fn write_override<W>(
&self,
handle: Handle<Override>,
out: &mut W,
) -> Result<(), Error>where
W: Write,
Write the WGSL form of
override
to out
.§fn write_non_wgsl_inner<W>(
&self,
inner: &TypeInner,
out: &mut W,
) -> Result<(), Error>where
W: Write,
fn write_non_wgsl_inner<W>(
&self,
inner: &TypeInner,
out: &mut W,
) -> Result<(), Error>where
W: Write,
§fn write_non_wgsl_scalar<W>(
&self,
scalar: Scalar,
out: &mut W,
) -> Result<(), Error>where
W: Write,
fn write_non_wgsl_scalar<W>(
&self,
scalar: Scalar,
out: &mut W,
) -> Result<(), Error>where
W: Write,
§fn write_type<W>(&self, handle: Handle<Type>, out: &mut W) -> Result<(), Error>where
W: Write,
fn write_type<W>(&self, handle: Handle<Type>, out: &mut W) -> Result<(), Error>where
W: Write,
Write the type
ty
as it would appear in a value’s declaration. Read more§fn write_type_inner<W>(
&self,
inner: &TypeInner,
out: &mut W,
) -> Result<(), Error>where
W: Write,
fn write_type_inner<W>(
&self,
inner: &TypeInner,
out: &mut W,
) -> Result<(), Error>where
W: Write,
§fn write_scalar<W>(&self, scalar: Scalar, out: &mut W) -> Result<(), Error>where
W: Write,
fn write_scalar<W>(&self, scalar: Scalar, out: &mut W) -> Result<(), Error>where
W: Write,
Write the
Scalar
scalar
as a WGSL type.§fn write_type_resolution<W>(
&self,
resolution: &TypeResolution,
out: &mut W,
) -> Result<(), Error>where
W: Write,
fn write_type_resolution<W>(
&self,
resolution: &TypeResolution,
out: &mut W,
) -> Result<(), Error>where
W: Write,
Write the
TypeResolution
resolution
as a WGSL type.fn write_type_conclusion<W>(
&self,
conclusion: &Conclusion,
out: &mut W,
) -> Result<(), Error>where
W: Write,
fn write_type_rule<W>(
&self,
name: &str,
rule: &Rule,
out: &mut W,
) -> Result<(), Error>where
W: Write,
fn type_to_string(&self, handle: Handle<Type>) -> String
fn type_resolution_to_string(&self, resolution: &TypeResolution) -> String
fn type_rule_to_string(&self, name: &str, rule: &Rule) -> String
impl<'a> Copy for GlobalCtx<'a>
Auto Trait Implementations§
impl<'a> Freeze for GlobalCtx<'a>
impl<'a> RefUnwindSafe for GlobalCtx<'a>
impl<'a> Send for GlobalCtx<'a>
impl<'a> Sync for GlobalCtx<'a>
impl<'a> Unpin for GlobalCtx<'a>
impl<'a> UnwindSafe for GlobalCtx<'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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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
.§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
.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.