Struct RustAssistant

Source
pub struct RustAssistant { /* private fields */ }
Expand description

The RustAssistant struct, providing functionalities to interact with crates and their contents.

This struct encapsulates methods for downloading crates, reading their content, and performing searches within them.

Implementations§

Source§

impl RustAssistant

Source

pub async fn get_crate(&self, crate_version: &CrateVersion) -> Result<Crate>

Retrieves a crate from the cache or downloads it if not already cached.

§Arguments
  • crate_version - A reference to CrateVersion specifying the crate to retrieve.
§Returns

A Result wrapping the Crate, or an error if the operation fails.

Source

pub async fn get_file_content( &self, crate_version_path: &CrateVersionPath, file_line_range: FileLineRange, ) -> Result<Option<FileContent>>

Retrieves the content of a file within a specified crate and range.

§Arguments
  • crate_version_path - A reference to CrateVersionPath specifying the crate and file path.
  • file_line_range - A FileLineRange specifying the range of lines to retrieve.
§Returns

A Result wrapping an Option<CrateFileContent>, or an error if the operation fails.

Source

pub async fn read_directory( &self, crate_version_path: CrateVersionPath, ) -> Result<Option<Directory>>

Reads the content of a directory within a specified crate.

§Arguments
  • crate_version_path - A CrateVersionPath specifying the crate and directory path.
§Returns

A Result wrapping an Option<Directory>, or an error if the operation fails.

Source

pub async fn search_item( &self, crate_version: &CrateVersion, query: impl Into<ItemQuery>, ) -> Result<Vec<Item>>

Searches for items in a crate based on a query.

§Arguments
  • crate_version - A reference to CrateVersion specifying the crate to search in.
  • query - An ItemQuery specifying the search criteria.
§Returns

A Result wrapping a Vec<Item>, or an error if the operation fails.

Source

pub async fn search_line( &self, crate_version: &CrateVersion, query: impl Into<LineQuery>, ) -> Result<Vec<Line>>

Searches for lines in a crate’s files based on a query.

§Arguments
  • crate_version - A reference to CrateVersion specifying the crate to search in.
  • query - A LineQuery specifying the search criteria.
§Returns

A Result wrapping a Vec<Line>, or an error if the operation fails.

Source

pub async fn read_github_repository_file( &self, repo: &Repository, path: &str, branch: impl Into<Option<&str>>, ) -> Result<Option<FileContent>>

Reads the content of a file within a specified GitHub repository.

§Arguments
  • repo - A reference to Repository specifying the GitHub repository.
  • path - A &str specifying the file path.
  • branch - An optional &str specifying the branch name.
§Returns

A Result wrapping a FileContent, or an error if the operation fails.

Source

pub async fn read_github_repository_directory( &self, repo: &Repository, path: &str, branch: impl Into<Option<&str>>, ) -> Result<Option<Directory>>

Reads the content of a directory within a specified GitHub repository.

§Arguments
  • repo - A reference to Repository specifying the GitHub repository.
  • path - A &str specifying the directory path.
  • branch - An optional &str specifying the branch name.
§Returns

A Result wrapping a Directory, or an error if the operation fails.

Source

pub async fn search_github_repository_for_issues( &self, repo: &Repository, query: &str, ) -> Result<Vec<Issue>>

Searches for issues in a specified GitHub repository based on a query.

§Arguments
  • repo - A reference to Repository specifying the GitHub repository.
  • query - A &str specifying the query string.
§Returns

A Result wrapping a Vec<Issue>, or an error if the operation fails.

Source

pub async fn get_github_repository_issue_timeline( &self, repo: &Repository, issue_number: u64, ) -> Result<Vec<IssueEvent>>

Retrieves the timeline of an issue in a specified GitHub repository.

§Arguments
  • repo - A reference to Repository specifying the GitHub repository.
  • issue_number - A u64 specifying the issue number.
§Returns

A Result wrapping a Vec<IssueEvent>, or an error if the operation fails.

Source

pub async fn get_github_repository_branches( &self, repo: &Repository, ) -> Result<Vec<String>>

Retrieves the branches of a specified GitHub repository.

Trait Implementations§

Source§

impl Clone for RustAssistant

Source§

fn clone(&self) -> RustAssistant

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 From<(CrateDownloader, CrateCache, GithubClient)> for RustAssistant

Source§

fn from( (downloader, cache, github): (CrateDownloader, CrateCache, GithubClient), ) -> Self

Creates a new RustAssistant instance from a tuple of dependencies.

Auto Trait Implementations§

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

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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,

Source§

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>,

Source§

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>,

Source§

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

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> ErasedDestructor for T
where T: 'static,