pub struct Java { /* private fields */ }Trait Implementations§
Source§impl Language<'_> for Java
impl Language<'_> for Java
Source§const NAME: &'static str = "java"
const NAME: &'static str = "java"
The lowercase conventional name for this language. This should be a
single identifier. It will be used as a prefix for various things;
for instance, it will identify this language in the config file, and
be used as a prefix when generating CLI parameters
Source§type Config = JavaConfig
type Config = JavaConfig
The configuration for this language. This configuration will be loaded
from a config file and, where possible, from the command line, via
serde. Read moreSource§fn new_from_config(config: Self::Config) -> Result<Self>
fn new_from_config(config: Self::Config) -> Result<Self>
Create an instance of this language from the loaded configuration.
Source§fn output_filename_for_crate(&self, crate_name: &CrateName) -> String
fn output_filename_for_crate(&self, crate_name: &CrateName) -> String
In multi-file mode, typeshare will output one separate file with this
name for each crate in the input set. These file names should have the
appropriate naming convention and extension for this language. Read more
Source§fn format_special_type(
&self,
special_ty: &SpecialRustType,
generic_context: &[TypeName],
) -> Result<String>
fn format_special_type( &self, special_ty: &SpecialRustType, generic_context: &[TypeName], ) -> Result<String>
Format a special type. This will handle things like arrays, primitives,
options, and so on. Every lanugage has different spellings for these types,
so this is one of the key methods that a language implementation needs to
deal with.
Source§fn begin_file(
&self,
w: &mut impl Write,
mode: FilesMode<&CrateName>,
) -> Result<()>
fn begin_file( &self, w: &mut impl Write, mode: FilesMode<&CrateName>, ) -> Result<()>
Write a header for typeshared code. This is called unconditionally
at the start of the output file (or at the start of all files, if in
multi-file mode). Read more
Source§fn write_imports<'a, Crates, Types>(
&self,
writer: &mut impl Write,
_crate_name: &CrateName,
imports: Crates,
) -> Result<()>where
Crates: IntoIterator<Item = (&'a CrateName, Types)>,
Types: IntoIterator<Item = &'a TypeName>,
fn write_imports<'a, Crates, Types>(
&self,
writer: &mut impl Write,
_crate_name: &CrateName,
imports: Crates,
) -> Result<()>where
Crates: IntoIterator<Item = (&'a CrateName, Types)>,
Types: IntoIterator<Item = &'a TypeName>,
For generating import statements. This is called only in multi-file
mode, after
begin_file and before any other writes. Read moreSource§fn end_file(
&self,
w: &mut impl Write,
_mode: FilesMode<&CrateName>,
) -> Result<()>
fn end_file( &self, w: &mut impl Write, _mode: FilesMode<&CrateName>, ) -> Result<()>
Write a header for typeshared code. This is called unconditionally
at the end of the output file (or at the end of all files, if in
multi-file mode). Read more
Source§fn write_type_alias(
&self,
_w: &mut impl Write,
_t: &RustTypeAlias,
) -> Result<()>
fn write_type_alias( &self, _w: &mut impl Write, _t: &RustTypeAlias, ) -> Result<()>
Write a type alias definition. Read more
Source§fn write_struct(&self, w: &mut impl Write, rs: &RustStruct) -> Result<()>
fn write_struct(&self, w: &mut impl Write, rs: &RustStruct) -> Result<()>
Write a struct definition. Read more
Source§fn write_enum(&self, w: &mut impl Write, e: &RustEnum) -> Result<()>
fn write_enum(&self, w: &mut impl Write, e: &RustEnum) -> Result<()>
Write an enum definition. Read more
Source§fn write_const(&self, _w: &mut impl Write, _c: &RustConst) -> Result<()>
fn write_const(&self, _w: &mut impl Write, _c: &RustConst) -> Result<()>
Write a constant variable. Read more
Source§fn mapped_type(&self, type_name: &TypeName) -> Option<Cow<'_, str>>
fn mapped_type(&self, type_name: &TypeName) -> Option<Cow<'_, str>>
Most languages provide manual overrides for specific types. When a type
is formatted with a name that matches a mapped type, the mapped type
name is formatted instead. Read more
Source§fn format_type(
&self,
ty: &RustType,
generic_context: &[TypeName],
) -> Result<String, Error>
fn format_type( &self, ty: &RustType, generic_context: &[TypeName], ) -> Result<String, Error>
Convert a Rust type into a type from this language. By default this
calls
format_simple_type, format_generic_type, or
format_special_type, depending on the type. There should only rarely
be a need to specialize this. Read moreSource§fn format_simple_type(
&self,
base: &TypeName,
generic_context: &[TypeName],
) -> Result<String, Error>
fn format_simple_type( &self, base: &TypeName, generic_context: &[TypeName], ) -> Result<String, Error>
Format a simple type with no generic parameters. Read more
Source§fn format_generic_type(
&self,
base: &TypeName,
parameters: &[RustType],
generic_context: &[TypeName],
) -> Result<String, Error>
fn format_generic_type( &self, base: &TypeName, parameters: &[RustType], generic_context: &[TypeName], ) -> Result<String, Error>
Format a generic type that takes in generic arguments, which
may be recursive. Read more
Source§fn format_generic_parameters(
&self,
parameters: &[RustType],
generic_context: &[TypeName],
) -> Result<String, Error>
fn format_generic_parameters( &self, parameters: &[RustType], generic_context: &[TypeName], ) -> Result<String, Error>
Format generic parameters into a syntax used by this language. By
default, this returns
<A, B, C, ...>, since that’s a common syntax
used by most languages. Read moreSource§fn write_struct_types_for_enum_variants(
&self,
w: &mut impl Write,
e: &RustEnum,
make_struct_name: &impl Fn(&TypeName) -> String,
) -> Result<(), Error>
fn write_struct_types_for_enum_variants( &self, w: &mut impl Write, e: &RustEnum, make_struct_name: &impl Fn(&TypeName) -> String, ) -> Result<(), Error>
Write out named types to represent anonymous struct enum variants. Read more
Source§fn exclude_from_import_analysis(&self, name: &TypeName) -> bool
fn exclude_from_import_analysis(&self, name: &TypeName) -> bool
If a type with this name appears in a type definition, it will be
unconditionally excluded from cross-file import analysis. Usually this will
be the types in
mapped_types, since those are types with special behavior
(for instance, a datetime date provided as a standard type by your
langauge). Read moreSource§fn write_additional_files<'a>(
&self,
output_folder: &Path,
output_files: impl IntoIterator<Item = (&'a CrateName, &'a Path)>,
) -> Result<(), Error>
fn write_additional_files<'a>( &self, output_folder: &Path, output_files: impl IntoIterator<Item = (&'a CrateName, &'a Path)>, ) -> Result<(), Error>
In multi-file mode, this method is called after all of the individual
typeshare files are completely generated. Use it to generate any
additional files your language might need in this directory to
function correctly, such as a
mod.rs, __init__.py, index.js, or
anything else like that. Read moreAuto Trait Implementations§
impl Freeze for Java
impl RefUnwindSafe for Java
impl Send for Java
impl Sync for Java
impl Unpin for Java
impl UnwindSafe for Java
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> 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