Enum Part
pub enum Part {
Thought {
text: String,
thought: bool,
},
Text {
text: String,
},
InlineData {
inline_data: Blob,
},
FunctionCall {
function_call: FunctionCall,
},
FunctionResponse {
function_response: FunctionResponse,
},
ExecutableCode {
executable_code: ExecutableCode,
},
CodeExecutionResult {
code_execution_result: CodeExecutionResult,
},
}Expand description
A single part of a Content message.
Parts are polymorphic — discriminated by field presence, not a type tag.
Variants§
Thought
A thought/reasoning part from the model (when includeThoughts is enabled).
Text
A text part.
InlineData
An inline data blob (audio, image, etc.).
FunctionCall
A function call from the model.
Fields
§
function_call: FunctionCallThe function call details.
FunctionResponse
A function response sent back to the model.
Fields
§
function_response: FunctionResponseThe function response details.
ExecutableCode
Executable code returned by the model.
Fields
§
executable_code: ExecutableCodeThe executable code details.
CodeExecutionResult
Result of code execution.
Fields
§
code_execution_result: CodeExecutionResultThe code execution result details.
Implementations§
§impl Part
impl Part
pub fn text(s: impl Into<String>) -> Part
pub fn text(s: impl Into<String>) -> Part
Create a text part.
§Examples
use gemini_genai_rs::protocol::types::Part;
let part = Part::text("Hello, world!");pub fn inline_data(
mime_type: impl Into<String>,
data: impl Into<String>,
) -> Part
pub fn inline_data( mime_type: impl Into<String>, data: impl Into<String>, ) -> Part
Create an inline data part (e.g. audio or image blob).
§Examples
use gemini_genai_rs::protocol::types::Part;
let audio = Part::inline_data("audio/pcm", "AQIDBA==");
let image = Part::inline_data("image/jpeg", "/9j/4AAQ...");pub fn function_call(call: FunctionCall) -> Part
pub fn function_call(call: FunctionCall) -> Part
Create a function call part.
Trait Implementations§
§impl<'de> Deserialize<'de> for Part
impl<'de> Deserialize<'de> for Part
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Part, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Part, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl Serialize for Part
impl Serialize for Part
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl StructuralPartialEq for Part
Auto Trait Implementations§
impl Freeze for Part
impl RefUnwindSafe for Part
impl Send for Part
impl Sync for Part
impl Unpin for Part
impl UnwindSafe for Part
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