Browse Source

better meta stuff

master
Alison Watson 2 years ago
parent
commit
cf8d7851d0
  1. 47
      source/framework/meta.rs
  2. 2
      source/framework/render/instance.rs

47
source/framework/meta.rs

@ -1,59 +1,38 @@
//! Meta-information of this crate.
#[macro_export]
macro_rules! doc_comment {
($x:expr, $($tt:tt)*) => {
#[doc = $x]
$($tt)*
};
}
macro_rules! meta_str {
($($(#[$outer:meta])* $name:ident = $e:expr;)*) => {
$($(#[$outer])* pub const fn $name() -> &'static str { $e })*
$($(#[$outer])* pub const $name: &'static str = $e;)*
pub mod ffi {
$(
doc_comment! {
concat!(
"FFI variant of [`",
stringify!($name),
"`]\n\n[`",
stringify!($name),
"`]: ../fn.",
stringify!($name),
".html"
),
pub const fn $name() -> crate::ffi::Nts { c_str!($e) }
}
)*
$(pub const $name: crate::ffi::Nts = c_str!($e);)*
}
}
}
meta_str! {
/// The authors of this crate, `:` separated.
authors = env!("CARGO_PKG_AUTHORS");
AUTHORS = env!("CARGO_PKG_AUTHORS");
/// The description of this crate.
description = env!("CARGO_PKG_DESCRIPTION");
DESCRIPTION = env!("CARGO_PKG_DESCRIPTION");
/// The home page of this crate.
homepage = env!("CARGO_PKG_HOMEPAGE");
HOMEPAGE = env!("CARGO_PKG_HOMEPAGE");
/// The full license text of this crate.
license_text = include_str!("../../LICENSE");
LICENSE_TEXT = include_str!("../../LICENSE");
/// The name of this crate.
name = env!("CARGO_PKG_NAME");
NAME = env!("CARGO_PKG_NAME");
/// The repository of this crate.
repository = env!("CARGO_PKG_REPOSITORY");
REPOSITORY = env!("CARGO_PKG_REPOSITORY");
/// The full version of this crate.
version = env!("CARGO_PKG_VERSION");
VERSION = env!("CARGO_PKG_VERSION");
/// The major version of this crate.
version_major = env!("CARGO_PKG_VERSION_MAJOR");
VERSION_MAJOR = env!("CARGO_PKG_VERSION_MAJOR");
/// The minor version of this crate.
version_minor = env!("CARGO_PKG_VERSION_MINOR");
VERSION_MINOR = env!("CARGO_PKG_VERSION_MINOR");
/// The patch version of this crate.
version_patch = env!("CARGO_PKG_VERSION_PATCH");
VERSION_PATCH = env!("CARGO_PKG_VERSION_PATCH");
/// The pre-release version of this crate.
version_pre = env!("CARGO_PKG_VERSION_PRE");
VERSION_PRE = env!("CARGO_PKG_VERSION_PRE");
}
// EOF

2
source/framework/render/instance.rs

@ -54,7 +54,7 @@ impl Instance {
let exts = window.vulkan_instance_extensions()?;
let app_info = vk::ApplicationInfo {
p_engine_name: meta::ffi::name(),
p_engine_name: meta::ffi::NAME,
api_version: vk::make_version(1, 0, 0),
..Default::default()
};

Loading…
Cancel
Save