#![cfg_attr(feature = "used_linker", feature(used_with_arg))]
#![recursion_limit = "256"]
#![no_std]
#![doc = include_str!("../docs/BUILD.md")]
#![doc = include_str!("../docs/PREAMBLE.md")]
#![doc = include_str!("../docs/GENERATED.md")]
#[cfg(feature = "std")]
extern crate std;
mod macros;
mod parse;
mod priority;
pub mod statics;
#[doc(hidden)]
#[allow(unused)]
pub mod __support {
#[deprecated(since = "0.12.0", note = "Use the dtor crate directly")]
#[cfg(feature = "dtor")]
pub use dtor::declarative::dtor as dtor_parse;
pub use crate::__ctor_parse as ctor_parse;
#[cfg(all(feature = "priority", target_vendor = "apple"))]
pub use link_section::declarative::in_section;
}
#[cfg(all(feature = "priority", target_vendor = "apple"))]
crate::__ctor_parse_internal!(
__ctor_features,
#[ctor(unsafe)]
fn priority_ctor() {
link_section::declarative::section!(
#[section(no_macro)]
pub static CTOR: link_section::TypedSection<(fn(), u16)>;
);
#[allow(unsafe_code)]
unsafe {
CTOR.as_mut_slice()
.sort_unstable_by_key(|(_, priority)| *priority);
}
for (ctor, _) in CTOR {
ctor();
}
}
);
pub mod declarative {
#[doc(inline)]
pub use crate::__support::ctor_parse as ctor;
#[deprecated(since = "0.12.0", note = "Use the dtor crate directly")]
#[cfg(feature = "dtor")]
#[doc(inline)]
pub use crate::__support::dtor_parse as dtor;
}
#[doc(inline)]
#[cfg(feature = "proc_macro")]
pub use ctor_proc_macro::ctor;
#[deprecated(since = "0.12.0", note = "Use the dtor crate directly")]
#[doc(inline)]
#[cfg(all(feature = "dtor", feature = "proc_macro"))]
pub use dtor::__dtor_from_ctor as dtor;
__declare_features!(
ctor: __ctor_features;
anonymous {
attr: [(anonymous) => (anonymous)];
};
crate_path {
attr: [(crate_path = $path:pat) => (($path))];
example: "crate_path = ::path::to::ctor::crate";
};
dtor {
feature: "dtor";
};
export_name_prefix {
attr: [(export_name_prefix = $export_name_prefix_str:literal) => ($export_name_prefix_str)];
example: "export_name_prefix = \"ctor_\"";
default {
(target_os = "aix") => "__sinit",
_ => (),
}
};
link_section {
attr: [(link_section = $section:literal) => ($section)];
example: "link_section = \".ctors\"";
default {
(target_vendor = "apple") => "__DATA,__mod_init_func,mod_init_funcs",
(any(
target_os = "linux",
target_os = "android",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd",
target_os = "dragonfly",
target_os = "illumos",
target_os = "haiku",
target_os = "vxworks",
target_os = "nto",
target_family = "wasm"
)) => ".init_array",
(target_os = "none") => ".init_array",
(target_arch = "xtensa") => ".ctors",
(all(target_vendor = "pc", any(target_env = "gnu", target_env = "msvc"))) => ".CRT$XCU",
(all(target_vendor = "pc", not(any(target_env = "gnu", target_env = "msvc")))) => ".ctors",
(all(target_os = "aix")) => (), _ => (compile_error!("Unsupported target for #[ctor]"))
}
};
no_warn_on_missing_unsafe {
feature: "no_warn_on_missing_unsafe";
attr: [(unsafe) => (no_warn_on_missing_unsafe)];
};
priority {
attr: [(priority = $priority_value:tt) => ($priority_value)];
validate: [(priority = $priority:literal), (priority = early), (priority = late)];
};
priority_enabled {
feature: "priority";
};
proc_macro {
feature: "proc_macro";
};
std {
feature: "std";
};
used_linker {
feature: "used_linker";
attr: [(used(linker)) => (used_linker)];
};
);
#[cfg(doc)]
__generate_docs!(__ctor_features);