#[non_exhaustive]pub enum Attachment {
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,
},
}Expand description
An attachment included with a user message.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
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.
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
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for Attachment
impl PartialEq for Attachment
Source§fn eq(&self, other: &Attachment) -> bool
fn eq(&self, other: &Attachment) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for Attachment
impl Serialize for Attachment
impl Eq 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
Mutably borrows from an owned value. Read more