pub enum BuildTarget {
Hb,
Bin,
Cdylib,
}Expand description
A build target is what runs htl’s output. The htl binary runs a .hb bundle; the
OS runs a native binary; a caller written in C, Python or C# loads a cdylib. That is
the axis, and it is the only thing the entries below differ about — README
“Build targets” has the
table of what each one produces.
§What is in the enum, and what is derived from it
The enum is over what runs the output, and nothing else. Cargo’s [lib] crate-type
and the entry-script rule are answers derived from an entry (crate_types,
entry), not fields stored beside it, so adding a target is adding one arm and the
answers it gives rather than a row of parallel data that can disagree with itself. A
platform or a target triple is deliberately not in here: bin on Linux and bin on
Windows are the same build target, and if a platform ever has to be named it is an
attribute of one target, not a fourth entry.
§Why it is not called a host
Two of the three entries happen to be Rust crates, which is why this used to be called
a host; an output nothing Rust runs — a .love bundle, say — is the entry that makes
that word plainly wrong.
Host keeps its own meaning throughout htl and is not this: it is the Rust side that
embeds the Lua state — #[host_module], the src/host.d.tl generated from it, and
[build] host / htl build --host x,y, which name the modules that side provides at
run time. A project can have a host and the default target (htl build alone), and two
targets can share one host, so they are two axes rather than two words for one.
Variants§
Hb
A .hb bundle, run by the htl binary. What plain htl build produces, and what
every project without Rust in it is.
Bin
A native binary, run by the OS: a library crate holding the host module and the embedded scripts, with a thin binary on top.
Cdylib
A C ABI library, loaded by a caller that is not written in Rust.
Implementations§
Source§impl BuildTarget
impl BuildTarget
Sourcepub const ALL: &'static [BuildTarget]
pub const ALL: &'static [BuildTarget]
Every target there is, in the order they are offered and reported.
Sourcepub fn name(&self) -> &'static str
pub fn name(&self) -> &'static str
How it is spelled on the command line (--target <name>) and in htl.toml.
Sourcepub fn names() -> Vec<&'static str>
pub fn names() -> Vec<&'static str>
Every name, in ALL order: what a flag offers and what a typo
is answered with.
Sourcepub fn crate_types(&self) -> &'static [&'static str]
pub fn crate_types(&self) -> &'static [&'static str]
[lib] crate-type = [...] beyond the default rlib, which needs no section at all.
Derived rather than stored: the crate shape is a consequence of what loads the
output, so it is answered here and Cargo.toml has nothing else to know about it.
Trait Implementations§
Source§impl Clone for BuildTarget
impl Clone for BuildTarget
Source§fn clone(&self) -> BuildTarget
fn clone(&self) -> BuildTarget
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for BuildTarget
Source§impl Debug for BuildTarget
impl Debug for BuildTarget
Source§impl<'de> Deserialize<'de> for BuildTarget
The string form is the only form: target = "cdylib" in htl.toml goes through
FromStr, so a name that is not one is refused with the same sentence the command
line answers a typo with, rather than with serde’s list of variant spellings.
impl<'de> Deserialize<'de> for BuildTarget
The string form is the only form: target = "cdylib" in htl.toml goes through
FromStr, so a name that is not one is refused with the same sentence the command
line answers a typo with, rather than with serde’s list of variant spellings.
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Source§impl Display for BuildTarget
impl Display for BuildTarget
impl Eq for BuildTarget
Source§impl FromStr for BuildTarget
impl FromStr for BuildTarget
Source§impl Hash for BuildTarget
impl Hash for BuildTarget
Source§impl PartialEq for BuildTarget
impl PartialEq for BuildTarget
impl StructuralPartialEq for BuildTarget
Auto Trait Implementations§
impl Freeze for BuildTarget
impl RefUnwindSafe for BuildTarget
impl Send for BuildTarget
impl Sync for BuildTarget
impl Unpin for BuildTarget
impl UnsafeUnpin for BuildTarget
impl UnwindSafe for BuildTarget
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more