Struct umm::java::File

source ·
pub struct File {
    path: PathBuf,
    file_name: String,
    package_name: Option<String>,
    imports: Option<Vec<HashMap<String, String>>>,
    name: String,
    proper_name: String,
    test_methods: Vec<String>,
    kind: FileType,
    parser: Parser,
    description: String,
}
Expand description

Struct representing a java file

Fields§

§path: PathBuf

path to java file.

§file_name: String

name of file.

§package_name: Option<String>

package the java file belongs to.

§imports: Option<Vec<HashMap<String, String>>>

imports made by the java file.

§name: String

name of the file TODO: How does this differ from file_name?

§proper_name: String

colored terminal string representing java file name.

§test_methods: Vec<String>

Name of tests methods in this file, as understood by JUnit.

§kind: FileType

Name of tests methods in this file, colored using terminal color codes.

§parser: Parser

The parser for this file

§description: String

Concise description of the file

Implementations§

source§

impl File

source

fn new(path: PathBuf) -> Result<Self>

Creates a new File from path

  • path: the path to read and try to create a File instance for.
source

pub fn new_script(path: PathBuf) -> Result<Self, Box<EvalAltResult>>

Macro generated variant of #fn_name that returns EvalAltResult. This allows the function to be used in scripts.

source

fn inner_doc_check(&self, err: Stdio, out: Stdio, in_: Stdio) -> Result<Output>

Returns the inner doc check of this File.

source

pub fn doc_check(&self) -> Result<String, JavaFileError>

Utility method to ask javac for documentation lints using the -Xdoclint flag.

The method simply returns the output produced by javac as a String. There is a ‘parse_diag method’ that can parse these to yield useful information.

source

pub fn doc_check_mut_script(&self) -> Result<String, Box<EvalAltResult>>

Utility method to ask javac for documentation lints using the -Xdoclint flag.

The method simply returns the output produced by javac as a String. There is a ‘parse_diag method’ that can parse these to yield useful information.

source

fn inner_check(&self, err: Stdio, out: Stdio, in_: Stdio) -> Result<Output>

Returns the inner check of this File.

source

pub fn check(&self) -> Result<String, JavaFileError>

Utility method to check for syntax errors using javac flag.

source

pub fn check_mut_script(&self) -> Result<String, Box<EvalAltResult>>

Utility method to check for syntax errors using javac flag.

source

fn inner_run( &self, input: Option<String>, err: Stdio, out: Stdio ) -> Result<Output>

Returns the inner run of this File.

source

pub fn run(&self, input: Option<String>) -> Result<String, JavaFileError>

Utility method to run a java file that has a main method.

source

pub fn run_mut_script( &self, input: Option<String> ) -> Result<String, Box<EvalAltResult>>

Utility method to run a java file that has a main method.

source

fn inner_test( &self, tests: Vec<&str>, err: Stdio, out: Stdio, in_: Stdio ) -> Result<Output>

Inner method to run tests.

source

pub fn test( &self, tests: Vec<&str>, project: Option<&Project> ) -> Result<String, JavaFileError>

A utility method that takes a list of strings (or types that implement Into<String>) meant to represent test method names, and runs those tests.

Returns the output from JUnit as a string. There are parsers in ‘parsers module’ that helps parse this output.

  • tests: list of strings (or types that implement Into<String>) meant to represent test method names,
source

pub fn test_mut_script( &mut self, tests: Vec<&str> ) -> Result<String, Box<EvalAltResult>>

A utility method that takes a list of strings (or types that implement Into<String>) meant to represent test method names, and runs those tests.

source

pub fn kind(&self) -> &FileType

A utility method that takes a list of strings (or types that implement Into<String>) meant to represent test method names, and runs those tests.

Returns the output from JUnit as a string. There are parsers in ‘parsers module’ that helps parse this output. Get a reference to the file’s kind.

source

pub fn file_name(&self) -> &str

Get a reference to the file’s file name.

source

pub fn test_methods(&self) -> Vec<String>

Get a reference to the file’s test methods.

source

pub fn test_methods_mut_script(&mut self) -> Array

Get a reference to the file’s test methods.

source

pub fn query(&self, q: &str) -> Result<Vec<HashMap<String, String>>>

treesitter query for this file

source

pub fn query_mut_script(&mut self, q: &str) -> Result<Array, Box<EvalAltResult>>

treesitter query for this file

source

pub fn path(&self) -> &PathBuf

Get a reference to the file’s path.

source

pub fn path_mut_script(&mut self) -> String

Get a reference to the file’s path.

source

pub fn package_name(&self) -> Option<&String>

Get a reference to the file’s proper name.

source

pub fn parser(&self) -> Parser

Get a reference to the file’s parser.

source

pub fn description(&self) -> String

Get a reference to the file’s description.

source

pub fn proper_name(&self) -> String

Get the file’s proper name.

Trait Implementations§

source§

impl Clone for File

source§

fn clone(&self) -> File

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl CustomType for File

source§

fn build(builder: TypeBuilder<'_, Self>)

Builds the custom type for use with the [Engine]. Read more
source§

impl Debug for File

source§

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

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

impl<'de> Deserialize<'de> for File

source§

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 Hash for File

Hash based on path

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 File

Two Files are equal if their paths are equal

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for File

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for File

Based on PartialEq

Auto Trait Implementations§

§

impl RefUnwindSafe for File

§

impl Send for File

§

impl Sync for File

§

impl Unpin for File

§

impl UnwindSafe for File

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
§

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

§

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

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

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

§

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

§

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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.
§

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

§

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

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

fn try_into<'async_trait>( self ) -> Pin<Box<dyn Future<Output = Result<U, <U as TryFrom<T>>::Error>> + 'async_trait>>
where T: 'async_trait,

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
source§

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