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
impl File
sourcefn new(path: PathBuf) -> Result<Self>
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.
sourcepub fn new_script(path: PathBuf) -> Result<Self, Box<EvalAltResult>>
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.
sourcefn inner_doc_check(&self, err: Stdio, out: Stdio, in_: Stdio) -> Result<Output>
fn inner_doc_check(&self, err: Stdio, out: Stdio, in_: Stdio) -> Result<Output>
Returns the inner doc check of this File
.
sourcepub fn doc_check(&self) -> Result<String, JavaFileError>
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.
sourcepub fn doc_check_mut_script(&self) -> Result<String, Box<EvalAltResult>>
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.
sourcefn inner_check(&self, err: Stdio, out: Stdio, in_: Stdio) -> Result<Output>
fn inner_check(&self, err: Stdio, out: Stdio, in_: Stdio) -> Result<Output>
Returns the inner check of this File
.
sourcepub fn check(&self) -> Result<String, JavaFileError>
pub fn check(&self) -> Result<String, JavaFileError>
Utility method to check for syntax errors using javac flag.
sourcepub fn check_mut_script(&self) -> Result<String, Box<EvalAltResult>>
pub fn check_mut_script(&self) -> Result<String, Box<EvalAltResult>>
Utility method to check for syntax errors using javac flag.
sourcefn inner_run(
&self,
input: Option<String>,
err: Stdio,
out: Stdio
) -> Result<Output>
fn inner_run( &self, input: Option<String>, err: Stdio, out: Stdio ) -> Result<Output>
Returns the inner run of this File
.
sourcepub fn run(&self, input: Option<String>) -> Result<String, JavaFileError>
pub fn run(&self, input: Option<String>) -> Result<String, JavaFileError>
Utility method to run a java file that has a main method.
sourcepub fn run_mut_script(
&self,
input: Option<String>
) -> Result<String, Box<EvalAltResult>>
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.
sourcefn inner_test(
&self,
tests: Vec<&str>,
err: Stdio,
out: Stdio,
in_: Stdio
) -> Result<Output>
fn inner_test( &self, tests: Vec<&str>, err: Stdio, out: Stdio, in_: Stdio ) -> Result<Output>
Inner method to run tests.
sourcepub fn test(
&self,
tests: Vec<&str>,
project: Option<&Project>
) -> Result<String, JavaFileError>
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 implementInto<String>
) meant to represent test method names,
sourcepub fn test_mut_script(
&mut self,
tests: Vec<&str>
) -> Result<String, Box<EvalAltResult>>
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.
sourcepub fn kind(&self) -> &FileType
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.
sourcepub fn test_methods(&self) -> Vec<String>
pub fn test_methods(&self) -> Vec<String>
Get a reference to the file’s test methods.
sourcepub fn test_methods_mut_script(&mut self) -> Array
pub fn test_methods_mut_script(&mut self) -> Array
Get a reference to the file’s test methods.
sourcepub fn query(&self, q: &str) -> Result<Vec<HashMap<String, String>>>
pub fn query(&self, q: &str) -> Result<Vec<HashMap<String, String>>>
treesitter query for this file
sourcepub fn query_mut_script(&mut self, q: &str) -> Result<Array, Box<EvalAltResult>>
pub fn query_mut_script(&mut self, q: &str) -> Result<Array, Box<EvalAltResult>>
treesitter query for this file
sourcepub fn path_mut_script(&mut self) -> String
pub fn path_mut_script(&mut self) -> String
Get a reference to the file’s path.
sourcepub fn package_name(&self) -> Option<&String>
pub fn package_name(&self) -> Option<&String>
Get a reference to the file’s proper name.
sourcepub fn description(&self) -> String
pub fn description(&self) -> String
Get a reference to the file’s description.
sourcepub fn proper_name(&self) -> String
pub fn proper_name(&self) -> String
Get the file’s proper name.
Trait Implementations§
source§impl<'de> Deserialize<'de> for File
impl<'de> Deserialize<'de> for File
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>,
source§impl PartialEq for File
impl PartialEq for File
Two File
s are equal if their paths are equal
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> 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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.