#[non_exhaustive]pub enum Attachment {
Show 14 variants
File {
path: PathBuf,
display_name: Option<String>,
line_range: Option<AttachmentLineRange>,
},
Directory {
path: PathBuf,
display_name: Option<String>,
},
Selection {
file_path: PathBuf,
text: String,
display_name: Option<String>,
selection: AttachmentSelectionRange,
},
Blob {
data: String,
mime_type: String,
display_name: Option<String>,
},
GitHubReference {
number: u64,
title: String,
reference_type: GitHubReferenceType,
state: String,
url: String,
},
GitHubCommit {
message: String,
oid: String,
repo: GitHubRepoPointer,
url: String,
},
GitHubRelease {
name: String,
repo: GitHubRepoPointer,
tag_name: String,
url: String,
},
GitHubActionsJob {
conclusion: Option<String>,
job_id: i64,
job_name: String,
repo: GitHubRepoPointer,
url: String,
workflow_name: String,
},
GitHubRepository {
description: Option<String>,
ref: Option<String>,
repo: GitHubRepoPointer,
url: String,
},
GitHubFileDiff {
base: Option<GitHubFileDiffSide>,
head: Option<GitHubFileDiffSide>,
url: String,
},
GitHubTreeComparison {
base: GitHubTreeComparisonSide,
head: GitHubTreeComparisonSide,
url: String,
},
GitHubUrl {
url: String,
},
GitHubFile {
path: String,
ref: String,
repo: GitHubRepoPointer,
url: String,
},
GitHubSnippet {
line_range: GitHubSnippetLineRange,
path: String,
ref: String,
repo: GitHubRepoPointer,
url: String,
},
}Expand description
An attachment included with a user message.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
File
A file path, optionally with a line range.
Fields
line_range: Option<AttachmentLineRange>Optional line range to focus on.
Directory
A directory path.
Fields
Selection
A text selection within a file.
Fields
selection: AttachmentSelectionRangeCharacter range of the selection.
Blob
Raw binary data (e.g. an image).
Fields
GitHubReference
A reference to a GitHub issue, PR, or discussion.
Fields
reference_type: GitHubReferenceTypeKind of reference.
GitHubCommit
A pointer to a GitHub commit.
Fields
repo: GitHubRepoPointerRepository the commit belongs to.
GitHubRelease
A pointer to a GitHub release.
Fields
repo: GitHubRepoPointerRepository the release belongs to.
GitHubActionsJob
A pointer to a GitHub Actions job.
Fields
conclusion: Option<String>Terminal conclusion of the job when finished (e.g. “success”, “failure”, “cancelled”). Absent for in-progress jobs.
repo: GitHubRepoPointerRepository the workflow run belongs to.
GitHubRepository
A pointer to a GitHub repository.
Fields
ref: Option<String>Git ref this attachment is anchored at (branch, tag, or commit). When absent the default branch is implied.
repo: GitHubRepoPointerRepository pointer.
GitHubFileDiff
A pointer to a single-file diff. At least one of head and base is present.
Fields
base: Option<GitHubFileDiffSide>File location on the base side of the diff. Absent for additions.
head: Option<GitHubFileDiffSide>File location on the head side of the diff. Absent for deletions.
GitHubTreeComparison
A pointer to a comparison between two git revisions.
Fields
base: GitHubTreeComparisonSideBase side of the comparison.
head: GitHubTreeComparisonSideHead side of the comparison.
GitHubUrl
A generic GitHub URL reference.
GitHubFile
A pointer to a file in a GitHub repository at a specific ref.
Fields
repo: GitHubRepoPointerRepository the file lives in.
GitHubSnippet
A pointer to a line range inside a file in a GitHub repository.
Fields
line_range: GitHubSnippetLineRangeLine range the snippet covers.
repo: GitHubRepoPointerRepository the file lives in.
Implementations§
Source§impl Attachment
impl Attachment
Sourcepub fn display_name(&self) -> Option<&str>
pub fn display_name(&self) -> Option<&str>
Returns the display name, if set.
Sourcepub fn label(&self) -> Option<String>
pub fn label(&self) -> Option<String>
Returns a human-readable label, deriving one from the path if needed.
Sourcepub fn ensure_display_name(&mut self)
pub fn ensure_display_name(&mut self)
Ensure display_name is populated when the variant supports one.
Trait Implementations§
Source§impl Clone for Attachment
impl Clone for Attachment
Source§fn clone(&self) -> Attachment
fn clone(&self) -> Attachment
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Attachment
impl Debug for Attachment
Source§impl<'de> Deserialize<'de> for Attachment
impl<'de> Deserialize<'de> for Attachment
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>,
impl Eq for Attachment
Source§impl PartialEq for Attachment
impl PartialEq for Attachment
Source§fn eq(&self, other: &Attachment) -> bool
fn eq(&self, other: &Attachment) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for Attachment
impl Serialize for Attachment
impl StructuralPartialEq for Attachment
Auto Trait Implementations§
impl Freeze for Attachment
impl RefUnwindSafe for Attachment
impl Send for Attachment
impl Sync for Attachment
impl Unpin for Attachment
impl UnsafeUnpin for Attachment
impl UnwindSafe for Attachment
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.