pub struct CompilerOptions { /* private fields */ }Expand description
Partial compiler options metadata.
Implementations§
Source§impl CompilerOptions
impl CompilerOptions
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates empty compiler options metadata.
Examples found in repository?
examples/basic_usage.rs (line 5)
4fn main() -> Result<(), Box<dyn std::error::Error>> {
5 let options = CompilerOptions::new()
6 .with_target("es2022".parse::<TsTarget>()?)
7 .with_module_resolution(TsModuleResolution::Bundler)
8 .with_strictness(TsStrictness::Strict);
9 let config = TsConfig::new()
10 .with_compiler_options(options)
11 .with_include(TsConfigInclude::new("src")?);
12
13 assert_eq!(config.include().len(), 1);
14 Ok(())
15}Sourcepub const fn with_target(self, target: TsTarget) -> Self
pub const fn with_target(self, target: TsTarget) -> Self
Sets the target option.
Examples found in repository?
examples/basic_usage.rs (line 6)
4fn main() -> Result<(), Box<dyn std::error::Error>> {
5 let options = CompilerOptions::new()
6 .with_target("es2022".parse::<TsTarget>()?)
7 .with_module_resolution(TsModuleResolution::Bundler)
8 .with_strictness(TsStrictness::Strict);
9 let config = TsConfig::new()
10 .with_compiler_options(options)
11 .with_include(TsConfigInclude::new("src")?);
12
13 assert_eq!(config.include().len(), 1);
14 Ok(())
15}Sourcepub fn with_module(self, module: &str) -> Self
pub fn with_module(self, module: &str) -> Self
Sets the module option label.
Sourcepub const fn with_module_resolution(
self,
module_resolution: TsModuleResolution,
) -> Self
pub const fn with_module_resolution( self, module_resolution: TsModuleResolution, ) -> Self
Sets the module resolution option.
Examples found in repository?
examples/basic_usage.rs (line 7)
4fn main() -> Result<(), Box<dyn std::error::Error>> {
5 let options = CompilerOptions::new()
6 .with_target("es2022".parse::<TsTarget>()?)
7 .with_module_resolution(TsModuleResolution::Bundler)
8 .with_strictness(TsStrictness::Strict);
9 let config = TsConfig::new()
10 .with_compiler_options(options)
11 .with_include(TsConfigInclude::new("src")?);
12
13 assert_eq!(config.include().len(), 1);
14 Ok(())
15}Sourcepub const fn with_strictness(self, strictness: TsStrictness) -> Self
pub const fn with_strictness(self, strictness: TsStrictness) -> Self
Sets strictness metadata.
Examples found in repository?
examples/basic_usage.rs (line 8)
4fn main() -> Result<(), Box<dyn std::error::Error>> {
5 let options = CompilerOptions::new()
6 .with_target("es2022".parse::<TsTarget>()?)
7 .with_module_resolution(TsModuleResolution::Bundler)
8 .with_strictness(TsStrictness::Strict);
9 let config = TsConfig::new()
10 .with_compiler_options(options)
11 .with_include(TsConfigInclude::new("src")?);
12
13 assert_eq!(config.include().len(), 1);
14 Ok(())
15}Sourcepub fn with_base_url(self, base_url: &str) -> Self
pub fn with_base_url(self, base_url: &str) -> Self
Sets the base URL option.
Sourcepub fn with_path_mapping(self, key: &str, values: Vec<String>) -> Self
pub fn with_path_mapping(self, key: &str, values: Vec<String>) -> Self
Adds a paths mapping.
Sourcepub const fn module_resolution(&self) -> Option<TsModuleResolution>
pub const fn module_resolution(&self) -> Option<TsModuleResolution>
Returns the module resolution option.
Trait Implementations§
Source§impl Clone for CompilerOptions
impl Clone for CompilerOptions
Source§fn clone(&self) -> CompilerOptions
fn clone(&self) -> CompilerOptions
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CompilerOptions
impl Debug for CompilerOptions
Source§impl Default for CompilerOptions
impl Default for CompilerOptions
Source§fn default() -> CompilerOptions
fn default() -> CompilerOptions
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for CompilerOptions
impl<'de> Deserialize<'de> for CompilerOptions
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for CompilerOptions
impl PartialEq for CompilerOptions
Source§fn eq(&self, other: &CompilerOptions) -> bool
fn eq(&self, other: &CompilerOptions) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for CompilerOptions
impl Serialize for CompilerOptions
impl Eq for CompilerOptions
impl StructuralPartialEq for CompilerOptions
Auto Trait Implementations§
impl Freeze for CompilerOptions
impl RefUnwindSafe for CompilerOptions
impl Send for CompilerOptions
impl Sync for CompilerOptions
impl Unpin for CompilerOptions
impl UnsafeUnpin for CompilerOptions
impl UnwindSafe for CompilerOptions
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