mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2026-10-08 12:16:43 +02:00
update impl_debug/impl_display
This commit is contained in:
parent
50c0ed1c66
commit
614b8ee5d9
2 changed files with 5 additions and 6 deletions
|
|
@ -69,12 +69,12 @@ mod deps; pub use self::deps::*;
|
||||||
|
|
||||||
/// Implement [`Debug`] in bulk.
|
/// Implement [`Debug`] in bulk.
|
||||||
#[macro_export] macro_rules! impl_debug (
|
#[macro_export] macro_rules! impl_debug (
|
||||||
(<$($T:ident $(: $U:ident)?),+> $S:ty|$self:ident,$w:ident|$body:block)=>{
|
(<$($T:ident $(: $U:ident)?),+> $S:ty: |$self:ident,$w:ident|$body:block)=>{
|
||||||
impl <$($T$(:$U)?),+> std::fmt::Debug for $S {
|
impl <$($T$(:$U)?),+> std::fmt::Debug for $S {
|
||||||
fn fmt (&$self, $w: &mut std::fmt::Formatter) -> std::fmt::Result $body
|
fn fmt (&$self, $w: &mut std::fmt::Formatter) -> std::fmt::Result $body
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
($S:ty|$self:ident,$w:ident|$body:block)=>{
|
($S:ty: |$self:ident,$w:ident|$body:block)=>{
|
||||||
impl std::fmt::Debug for $S {
|
impl std::fmt::Debug for $S {
|
||||||
fn fmt (&$self, $w: &mut std::fmt::Formatter) -> std::fmt::Result $body
|
fn fmt (&$self, $w: &mut std::fmt::Formatter) -> std::fmt::Result $body
|
||||||
}
|
}
|
||||||
|
|
@ -83,12 +83,12 @@ mod deps; pub use self::deps::*;
|
||||||
|
|
||||||
/// Implement [`Display`] in bulk.
|
/// Implement [`Display`] in bulk.
|
||||||
#[macro_export] macro_rules! impl_display (
|
#[macro_export] macro_rules! impl_display (
|
||||||
(<$($T:ident $(: $U:ident)?),+> $S:ty|$self:ident,$w:ident|$body:block)=>{
|
(<$($T:ident $(: $U:ident)?),+> $S:ty: |$self:ident,$w:ident|$body:block)=>{
|
||||||
impl <$($T$(:$U)?),+> std::fmt::Display for $S {
|
impl <$($T$(:$U)?),+> std::fmt::Display for $S {
|
||||||
fn fmt (&$self, $w: &mut std::fmt::Formatter) -> std::fmt::Result $body
|
fn fmt (&$self, $w: &mut std::fmt::Formatter) -> std::fmt::Result $body
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
($S:ty|$self:ident,$w:ident|$body:block)=>{
|
($S:ty: |$self:ident,$w:ident|$body:block)=>{
|
||||||
impl std::fmt::Display for $S {
|
impl std::fmt::Display for $S {
|
||||||
fn fmt (&$self, $w: &mut std::fmt::Formatter) -> std::fmt::Result $body
|
fn fmt (&$self, $w: &mut std::fmt::Formatter) -> std::fmt::Result $body
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,7 @@ use ::ratatui::buffer::Cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_from!(BigBuffer: |size:(usize, usize)| Self::new(size.0, size.1));
|
impl_from!(BigBuffer: |size:(usize, usize)| Self::new(size.0, size.1));
|
||||||
|
impl_debug!(BigBuffer: |self, f| { write!(f, "[BB {}x{} ({})]", self.width, self.height, self.content.len()) });
|
||||||
impl_debug!(BigBuffer |self, f| { write!(f, "[BB {}x{} ({})]", self.width, self.height, self.content.len()) });
|
|
||||||
|
|
||||||
impl BigBuffer {
|
impl BigBuffer {
|
||||||
pub fn new (width: usize, height: usize) -> Self {
|
pub fn new (width: usize, height: usize) -> Self {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue