#pub #visibility #public #attributes #module #macro

nightly apply_pub

A Rust syntax extension for applying the pub visibility modifer to many items at once

1 unstable release

Uses old Rust 2015

0.0.2 Nov 24, 2014

#9 in #visibility

MIT license

8KB
134 lines

apply-pub-rs

A Rust syntax extension for applying the pub visibility modifer to many items at once.

Right now the attribute applies to every possible child AST element that could have public visibility, including:

  • use
  • static
  • fn, both standalone and methods/associated ones
  • mod
  • type, struct and enum
  • trait
  • symbols in extern {} blocks.

Example

Add this to your Cargo.toml:

[dependencies.apply-pub-rs]
git = "https://github.com/Kimundi/apply-pub-rs"

To load the extension and use it:

#![feature(phase)]

#[phase(plugin)]
extern crate apply_pub;

#[apply_pub]
mod foo {
    fn bar() {}
    mod baz {
        fn qux() {}
    }
}

fn main() {
    foo::bar();
    foo::baz::qux();
}

lib.rs:

A Rust syntax extension for applying the pub visibility modifer to many items at once

Right now the attribute applies to every possible child AST element that could have public visibility, including:

  • use
  • static
  • fn, both standalone and methods/associated ones
  • mod
  • type, struct and enum
  • trait
  • symbols in extern {} blocks.

Example

To load the extension and use it:

#![feature(phase)]

#[phase(plugin)]
extern crate apply_pub;

#[apply_pub]
mod foo {
fn bar() {}
mod baz {
fn qux() {}
}
}

fn main() {
foo::bar();
foo::baz::qux();
}

No runtime deps