pub struct ImportConfig {
pub name: &'static str,
pub alias: &'static str,
pub module: &'static str,
pub is_type: bool,
}Expand description
Configuration for a single import to be added to a file.
Used with TsStream::add_imports to batch-add multiple imports.
§Example
ⓘ
use macroforge_ts_syn::ImportConfig;
const MY_IMPORTS: &[ImportConfig] = &[
ImportConfig::value("ok", "__mf_ok", "@macroforge/core/endec"),
ImportConfig::type_only("Result", "__mf_Result", "@macroforge/core/endec"),
];
stream.add_imports(MY_IMPORTS);Fields§
§name: &'static strThe original export name from the source module
alias: &'static strThe alias to use in the generated import (typically __mf_ prefixed)
module: &'static strThe module path to import from
is_type: boolWhether this is a type-only import (import type { ... })
Implementations§
Source§impl ImportConfig
impl ImportConfig
Trait Implementations§
Source§impl Clone for ImportConfig
impl Clone for ImportConfig
impl Copy for ImportConfig
Auto Trait Implementations§
impl Forget for ImportConfig
impl Freeze for ImportConfig
impl Move for ImportConfig
impl RefUnwindSafe for ImportConfig
impl Send for ImportConfig
impl Sync for ImportConfig
impl Unpin for ImportConfig
impl UnsafeUnpin for ImportConfig
impl UnwindSafe for ImportConfig
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
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 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> ⓘ
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