New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

tvision-rs-macros

Package Overview
Dependencies
Maintainers
0
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tvision-rs-macros

Source
crates.io
Version
0.18.0
Version published
Maintainers
0
Created
Source

tvision-rs-macros

Procedural macros for tvision-rs, an idiomatic Rust port of Turbo Vision (magiblot/tvision).

This is an internal companion crate: it has no standalone use and its API is driven by the needs of tvision-rs. You normally depend on tvision-rs, which re-exports what it needs from here.

#[delegate]

The crate provides one attribute macro, #[delegate(to = <field>, skip(...))], the boilerplate half of the port's embed-and-delegate pattern (the stand-in for C++ implementation inheritance). On an impl Trait for Type block it injects forwarders for every trait method the block does not already provide, each forwarding to self.<field>.<method>(<args>):

use tvision_rs::delegate;

#[delegate(to = inner)]
impl View for MyWidget {
    // Write only the methods that differ; everything else forwards to `inner`.
    fn handle_event(&mut self, event: &Event, ctx: &mut Context) { /* ... */ }
}
  • to = <field> (required): the field to forward un-provided methods to.
  • skip(method1, method2, ...) (optional): methods to leave at the trait's own default instead of forwarding.

Only the View trait is currently supported.

License

MIT — see the repository.

FAQs

Package last updated on 19 Oct 2026

Related posts