update doctexts and fix a reexport
Some checks failed
/ build (push) Has been cancelled

This commit is contained in:
facile pop culture reference 2026-08-04 12:23:14 +03:00
parent 7f9b7091e2
commit ac9fd7dfba
4 changed files with 24 additions and 50 deletions

View file

@ -57,7 +57,7 @@ def_layout_modifier!(
Self::WH(item, w, h) => (item, (*w).into().unwrap_or(h0), (*h).into().unwrap_or(h0)),
_ => unreachable!()
};
to.draw(XYWH(x, y, w0, h0), item)
to.draw(XYWH(x, y, w, h), item)
}
);
@ -161,12 +161,15 @@ def_layout_modifier!(
///
/// ```
/// # fn doctest_layout_full () -> Result<(), Box<dyn std::error::Error>> {
/// use tengri::{Layout, Draw, XYWH};
/// use tengri::{Layout, Draw, XYWH, Tui, Perhaps, Screen};
/// let area = XYWH(0u16, 0, 80, 25);
/// assert_eq!("1".layout(area)?, Some(XYWH(0u16, 0, 1, 1)));
/// assert_eq!("1".full_w().layout(area)?, Some(XYWH(0u16, 0, 80, 1)));
/// assert_eq!("1".full_h().layout(area)?, Some(XYWH(0u16, 0, 1, 25)));
/// assert_eq!("1".full_wh().layout(area)?, Some(XYWH(0u16, 0, 80, 25)));
/// assert_eq!(layout("1")?, Some(XYWH(0u16, 0, 1, 1)));
/// assert_eq!(layout("1".full_w())?, Some(XYWH(0u16, 0, 80, 1)));
/// assert_eq!(layout("1".full_h())?, Some(XYWH(0u16, 0, 1, 25)));
/// assert_eq!(layout("1".full_wh())?, Some(XYWH(0u16, 0, 80, 25)));
/// fn layout (t: impl Draw<Tui>) -> Perhaps<XYWH<u16>> {
/// Tui::Layout(XYWH(0u16, 0, 80, 25)).size(None, t)
/// }
/// # Ok(()) }
/// ```
pub enum Full<T: Screen, I: Draw<T>> {

View file

@ -181,12 +181,12 @@ impl Split {
/// ```
/// use tengri::*;
/// let _ = Split::Above.stack("", "");
/// let _ = Split::Below.stack("", "");
/// let _ = Split::North.stack("", "");
/// let _ = Split::South.stack("", "");
/// let _ = Split::East.stack("", "");
/// let _ = Split::West.stack("", "");
/// let _ = Split::Above.stack(&"", &"");
/// let _ = Split::Below.stack(&"", &"");
/// let _ = Split::North.stack(&"", &"");
/// let _ = Split::South.stack(&"", &"");
/// let _ = Split::East.stack(&"", &"");
/// let _ = Split::West.stack(&"", &"");
/// ```
pub const fn stack <S: Screen, A: Draw<S>, B: Draw<S>> (&self, a: A, b: B) -> impl Draw<S> {
Pair(*self, a, b, PhantomData)
@ -194,12 +194,12 @@ impl Split {
/// ```
/// use tengri::*;
/// let _ = Split::Above.half("", "");
/// let _ = Split::Below.half("", "");
/// let _ = Split::North.half("", "");
/// let _ = Split::South.half("", "");
/// let _ = Split::East.half("", "");
/// let _ = Split::West.half("", "");
/// let _ = Split::Above.half(&"", &"");
/// let _ = Split::Below.half(&"", &"");
/// let _ = Split::North.half(&"", &"");
/// let _ = Split::South.half(&"", &"");
/// let _ = Split::East.half(&"", &"");
/// let _ = Split::West.half(&"", &"");
/// ```
pub const fn half <S: Screen, A: Draw<S>, B: Draw<S>> (&self, a: &A, b: &B) -> impl Draw<S> {
draw(move|to: &mut S|{

View file

@ -349,7 +349,7 @@ macro_rules! eval_xy (
#[cfg(feature = "sing")] pub use self::sing::*;
#[cfg(feature = "sing")] mod sing {
use crate::{*, time::PerfModel};
pub use ::jack::{*, contrib::{TimebaseInfo, ClosureProcessHandler, Position as JackPosition}};
pub use ::jack::{*, contrib::{TimebaseInfo, ClosureProcessHandler, PositionBBT, Position as JackPosition}};
pub use ::midly::{Smf, TrackEventKind, MidiMessage, Error as MidiError, num::*, live::*};
use ConnectName::*;
use ConnectScope::*;
@ -1349,36 +1349,7 @@ macro_rules! eval_xy (
use Azimuth::*;
use Split::*;
/// Output target.
///
/// ```
/// use tengri::*;
/// struct TestOut { w: u16, h: u16 };
/// impl Wide<u16> for TestOut {}
/// impl Tall<u16> for TestOut {}
/// impl Xy<u16> for TestOut {
/// fn x (&self) -> u16 { 0 }
/// fn y (&self) -> u16 { 0 }
/// }
/// impl Screen for TestOut {
/// type Unit = u16;
/// fn area (&self) -> XYWH<Self::Unit> {
/// Default::default()
/// }
/// fn draw (
/// &mut self,
/// area: impl Into<Option<XYWH<u16>>>,
/// draw: Draw<Self>
/// ) -> Perhaps<XYWH<Self::Unit>> {
/// draw.draw(self)
/// }
/// }
///
/// impl_draw!(|self: String, to: TestOut|{
/// to.w = self.len() as u16;
/// Ok(None)
/// });
/// ```
/// Output target. See [Tui] for example implementation.
pub trait Screen: Xy<Self::Unit> + Wh<Self::Unit> + Send + Sync + Sized {
type Unit: Coord;
/// Get current clipping area

View file

@ -302,7 +302,7 @@ impl Tui {
/// Ok(None),
/// Err("fail".into()),
/// ] {
/// let _ = tengri::Tui::catcher(variant);
/// let _ = tengri::Tui::catcher(&variant);
/// }
/// ```
pub fn catcher <T: Draw<Tui>> (result: &Usually<T>) -> impl Draw<Tui> {