ImageIntegration

Struct ImageIntegration 

Source
pub struct ImageIntegration {
    pub enabled: bool,
    pub max_images_per_prompt: usize,
    pub current_images: Vec<PathBuf>,
}
Expand description

Image integration manager for ricecoder-tui

Handles:

  • Drag-and-drop event detection and forwarding to ricecoder-images
  • Image display coordination with ricecoder-images ImageDisplay
  • Image context management for prompts

§Requirements

  • Req 1.1: Create interface for receiving drag-and-drop events from ricecoder-tui
  • Req 1.1: Implement file path extraction from events
  • Req 1.1: Handle multiple files in single drag-and-drop

Fields§

§enabled: bool

Whether image integration is enabled

§max_images_per_prompt: usize

Maximum number of images per prompt

§current_images: Vec<PathBuf>

Current images in the prompt context

Implementations§

Source§

impl ImageIntegration

Source

pub fn new() -> Self

Create a new image integration manager

Source

pub fn handle_drag_drop_event( &mut self, paths: Vec<PathBuf>, ) -> (Vec<PathBuf>, Vec<String>)

Handle a drag-and-drop event

§Arguments
  • paths - File paths from the drag-and-drop event
§Returns

Vector of successfully added image paths and any errors

§Requirements
  • Req 1.1: Handle multiple files in single drag-and-drop
  • Req 1.1: Implement file existence and permission checks
Source

pub fn remove_image(&mut self, path: &PathBuf) -> bool

Remove an image from the prompt context

§Arguments
  • path - Path to the image to remove
§Returns

True if image was removed, false if not found

Source

pub fn clear_images(&mut self)

Clear all images from the prompt context

Source

pub fn get_images(&self) -> &[PathBuf]

Get the current images in the prompt context

Source

pub fn has_images(&self) -> bool

Check if there are any images in the prompt context

Source

pub fn image_count(&self) -> usize

Get the number of images in the prompt context

Source

pub fn enable(&mut self)

Enable image integration

Source

pub fn disable(&mut self)

Disable image integration

Source

pub fn set_max_images(&mut self, max: usize)

Set the maximum number of images per prompt

Trait Implementations§

Source§

impl Default for ImageIntegration

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. 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