Skip to main content

ServerInterface

Struct ServerInterface 

Source
pub struct ServerInterface<'a> { /* private fields */ }
Expand description

A safe wrapper around Adobe’s ExtendScript server interface.

This struct provides a safe and idiomatic Rust interface to the underlying C API, handling memory management, type conversions, and error handling automatically.

Implementations§

Source§

impl<'a> ServerInterface<'a>

Source

pub fn new(interface: &'a SoServerInterface, server: SoHServer) -> Self

Creates a new ServerInterface instance.

§Arguments
  • interface - Reference to the SoServerInterface function table
  • server - Server handle for object management
Source

pub fn server(&self) -> SoHServer

Get the server handle

Source

pub fn raw_interface(&self) -> *const SoServerInterface

Get the raw interface pointer

Source

pub fn dump_object(&self, h_object: SoHObject) -> c_long

Dumps the current state of an object for debugging purposes.

§Arguments
  • h_object - Handle to the object to dump
§Returns
  • ESerror_t - Error code indicating success or failure
Source

pub fn dump_server(&self) -> c_long

Dumps the current state of the server for debugging purposes.

§Returns
  • ESerror_t - Error code indicating success or failure
Source

pub fn get_live_object( &self, h_object: SoHObject, name: &str, ) -> Result<TaggedData, c_long>

Gets a property value from a live object.

§Arguments
  • h_object - Handle to the object
  • name - Name of the property to get
§Returns
  • Result<TaggedData, ESerror_t> - The property value or error code
Source

pub fn get_live_object_from_raw_address( &self, h_object: SoHObject, address: *mut c_void, ) -> Result<TaggedData, c_long>

Source

pub fn put_live_object( &self, h_object: SoHObject, name: &str, value: &TaggedData, ) -> c_long

Sets a property value on a live object.

§Arguments
  • h_object - Handle to the object
  • name - Name of the property to set
  • value - Value to set
§Returns
  • ESerror_t - Error code indicating success or failure
Source

pub fn call_live_object( &self, h_object: SoHObject, method: &str, args: &[TaggedData], ) -> Result<TaggedData, c_long>

Calls a method on a live object.

§Arguments
  • h_object - Handle to the object
  • method - Name of the method to call
  • args - Array of arguments to pass to the method
§Returns
  • Result<TaggedData, ESerror_t> - The return value or error code
Source

pub fn eval(&self, script: &str) -> Result<TaggedData, c_long>

Evaluates a JavaScript script.

§Arguments
  • script - JavaScript code to evaluate
§Returns
  • Result<TaggedData, ESerror_t> - The result of evaluation or error code
Source

pub fn tagged_data_init(&self) -> Result<TaggedData, c_long>

Initializes a new TaggedData instance.

§Returns
  • Result<TaggedData, ESerror_t> - The initialized TaggedData or error code
Source

pub fn tagged_data_free(&self, data: &mut TaggedData)

Frees a TaggedData instance.

§Arguments
  • data - TaggedData instance to free
Source

pub fn add_class( &self, name: &str, object_interface: &mut SoObjectInterface, ) -> c_long

Adds a new JavaScript class.

§Arguments
  • name - Name of the class
  • object_interface - Interface implementation for the class
§Returns
  • ESerror_t - Error code indicating success or failure
Source

pub fn add_method( &self, h_object: SoHObject, name: &str, id: i32, desc: &str, ) -> c_long

Adds a method to an object.

§Arguments
  • h_object - Handle to the object
  • name - Name of the method
  • id - Method ID
  • desc - Method description
§Returns
  • ESerror_t - Error code indicating success or failure
Source

pub fn add_methods( &self, h_object: SoHObject, names: &mut [SoCClientName], ) -> c_long

Adds multiple methods to an object.

§Arguments
  • h_object - Handle to the object
  • names - Array of method definitions
§Returns
  • ESerror_t - Error code indicating success or failure
Source

pub fn add_property( &self, h_object: SoHObject, name: &str, id: i32, desc: &str, ) -> c_long

Adds a property to an object.

§Arguments
  • h_object - Handle to the object
  • name - Name of the property
  • id - Property ID
  • desc - Property description
§Returns
  • ESerror_t - Error code indicating success or failure
Source

pub fn add_properties( &self, h_object: SoHObject, names: &mut [SoCClientName], ) -> c_long

Adds multiple properties to an object.

§Arguments
  • h_object - Handle to the object
  • names - Array of property definitions
§Returns
  • ESerror_t - Error code indicating success or failure
Source

pub fn get_class( &self, h_object: SoHObject, max_name_len: i32, ) -> Result<String, c_long>

Gets the class name of an object.

§Arguments
  • h_object - Handle to the object
  • max_name_len - Maximum length of the class name
§Returns
  • Result<String, ESerror_t> - The class name or error code
Source

pub fn get_server( &self, h_object: SoHObject, ) -> Result<(SoHServer, &'a SoServerInterface), c_long>

Gets the server interface for an object.

§Arguments
  • h_object - Handle to the object
§Returns
  • Result<(SoHServer, &'a SoServerInterface), ESerror_t> - Server handle and interface or error code
Source

pub fn set_client_data( &self, h_object: SoHObject, client_data: *mut c_void, ) -> c_long

Sets client data for an object.

§Arguments
  • h_object - Handle to the object
  • client_data - Pointer to client data
§Returns
  • ESerror_t - Error code indicating success or failure
Source

pub fn get_client_data<T>(&self, h_object: SoHObject) -> Result<*mut T, c_long>

Gets client data from an object.

§Type Parameters
  • T - Type of the client data
§Arguments
  • h_object - Handle to the object
§Returns
  • Result<*mut T, ESerror_t> - Pointer to client data or error code

Trait Implementations§

Source§

impl<'a> Clone for ServerInterface<'a>

Source§

fn clone(&self) -> ServerInterface<'a>

Returns a duplicate 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<'a> Copy for ServerInterface<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for ServerInterface<'a>

§

impl<'a> RefUnwindSafe for ServerInterface<'a>

§

impl<'a> !Send for ServerInterface<'a>

§

impl<'a> !Sync for ServerInterface<'a>

§

impl<'a> Unpin for ServerInterface<'a>

§

impl<'a> UnsafeUnpin for ServerInterface<'a>

§

impl<'a> UnwindSafe for ServerInterface<'a>

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