mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-03 07:04:34 +00:00
Add a few Debug impl
This commit is contained in:
parent
3651d77a06
commit
681f304768
3 changed files with 23 additions and 1 deletions
|
@ -437,6 +437,12 @@ pub struct VOffset<Base, T: ?Sized + VTableMeta, PinFlag = NotPinnedFlag> {
|
||||||
phantom: PhantomData<FieldOffset<Base, (), PinFlag>>,
|
phantom: PhantomData<FieldOffset<Base, (), PinFlag>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<Base, T: ?Sized + VTableMeta, PinFlag> core::fmt::Debug for VOffset<Base, T, PinFlag> {
|
||||||
|
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||||
|
write!(f, "VOffset({})", self.offset)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<Base, T: ?Sized + VTableMeta, Flag> VOffset<Base, T, Flag> {
|
impl<Base, T: ?Sized + VTableMeta, Flag> VOffset<Base, T, Flag> {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn apply<'a>(self, x: &'a Base) -> VRef<'a, T> {
|
pub fn apply<'a>(self, x: &'a Base) -> VRef<'a, T> {
|
||||||
|
|
|
@ -19,7 +19,7 @@ pub enum TraversalOrder {
|
||||||
/// -1 means the visitor will continue
|
/// -1 means the visitor will continue
|
||||||
/// otherwise this is the index of the item that aborted the visit.
|
/// otherwise this is the index of the item that aborted the visit.
|
||||||
#[repr(transparent)]
|
#[repr(transparent)]
|
||||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
#[derive(Copy, Clone, Eq, PartialEq)]
|
||||||
pub struct VisitChildrenResult(i64);
|
pub struct VisitChildrenResult(i64);
|
||||||
impl VisitChildrenResult {
|
impl VisitChildrenResult {
|
||||||
/// The result used for a visitor that want to continue the visit
|
/// The result used for a visitor that want to continue the visit
|
||||||
|
@ -50,10 +50,20 @@ impl VisitChildrenResult {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
impl core::fmt::Debug for VisitChildrenResult {
|
||||||
|
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||||
|
if self.0 == -1 {
|
||||||
|
write!(f, "CONTINUE")
|
||||||
|
} else {
|
||||||
|
write!(f, "({},{})", (self.0 & 0xffff_ffff) as usize, (self.0 >> 32) as usize)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// The item tree is an array of ItemTreeNode representing a static tree of items
|
/// The item tree is an array of ItemTreeNode representing a static tree of items
|
||||||
/// within a component.
|
/// within a component.
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
|
#[derive(Debug)]
|
||||||
pub enum ItemTreeNode<T> {
|
pub enum ItemTreeNode<T> {
|
||||||
/// Static item
|
/// Static item
|
||||||
Item {
|
Item {
|
||||||
|
|
|
@ -153,6 +153,12 @@ pub struct Instance {
|
||||||
_opaque: [u8; 0],
|
_opaque: [u8; 0],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl core::fmt::Debug for Instance {
|
||||||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
|
write!(f, "Instance({:p})", self)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// A pointer to an Instance that automaticaly frees the memory after use
|
/// A pointer to an Instance that automaticaly frees the memory after use
|
||||||
pub struct InstanceBox(core::ptr::NonNull<Instance>);
|
pub struct InstanceBox(core::ptr::NonNull<Instance>);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue