Skip to main content

BuildTarget

Enum BuildTarget 

Source
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

Source

pub const ALL: &'static [BuildTarget]

Every target there is, in the order they are offered and reported.

Source

pub fn name(&self) -> &'static str

How it is spelled on the command line (--target <name>) and in htl.toml.

Source

pub fn names() -> Vec<&'static str>

Every name, in ALL order: what a flag offers and what a typo is answered with.

Source

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.

Source

pub fn entry(&self) -> Script

What this target has to say about src/main.tl.

Source

pub fn runs_it(&self) -> &'static str

Who is on the far end, in the words the README’s table and htl new’s refusals use.

Trait Implementations§

Source§

impl Clone for BuildTarget

Source§

fn clone(&self) -> BuildTarget

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for BuildTarget

Source§

impl Debug for BuildTarget

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
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.

Source§

fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for BuildTarget

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for BuildTarget

Source§

impl FromStr for BuildTarget

Source§

type Err = String

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl Hash for BuildTarget

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for BuildTarget

Source§

fn eq(&self, other: &BuildTarget) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BuildTarget

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> MaybeSend for T

Source§

impl<T> MaybeSync for T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.