Struct perspective_python::PySyncClient
source · pub struct PySyncClient(/* private fields */);Implementations§
source§impl PySyncClient
impl PySyncClient
pub fn new(callback: Py<PyAny>) -> PyResult<Self>
pub fn handle_response( &self, py: Python<'_>, response: Py<PyBytes>, ) -> PyResult<bool>
sourcepub fn table(
&self,
py: Python<'_>,
input: Py<PyAny>,
limit: Option<u32>,
index: Option<Py<PyString>>,
name: Option<Py<PyString>>,
) -> PyResult<PySyncTable>
pub fn table( &self, py: Python<'_>, input: Py<PyAny>, limit: Option<u32>, index: Option<Py<PyString>>, name: Option<Py<PyString>>, ) -> PyResult<PySyncTable>
[Table] is Perspective’s columnar data frame, analogous to a Pandas
DataFrame or Apache Arrow, supporting append & in-place updates, removal by
index, and update notifications.
A [Table] contains columns, each of which have a unique name, are strongly and
consistently typed, and contains rows of data conforming to the column’s type.
Each column in a [Table] must have the same number of rows, though not every
row must contain data; null-values are used to indicate missing values in the
dataset.
The schema of a [Table] is immutable after creation, which means the column
names and data types cannot be changed after the [Table] has been created.
Columns cannot be added or deleted after creation either, but a [View] can be
used to select an arbitrary set of columns from the [Table].
sourcepub fn open_table(&self, name: String) -> PyResult<PySyncTable>
pub fn open_table(&self, name: String) -> PyResult<PySyncTable>
Opens a [Table] that is hosted on the perspective_server::Server that is
connected to this [Client].
The name property of [TableInitOptions] is used to identify each [Table].
[Table] names can be looked up for each [Client] via
[Client::get_hosted_table_names].
§JavaScript Examples
Get a virtual [Table] named “table_one” from this [Client]
const tables = await client.open_table("table_one");
§Python Examples
tables = client.open_table("table_one");
§Examples
let tables = client.open_table("table_one").await;sourcepub fn get_hosted_table_names(&self) -> PyResult<Vec<String>>
pub fn get_hosted_table_names(&self) -> PyResult<Vec<String>>
Retrieves the names of all tables that this client has access to.
name is a string identifier unique to the [Table] (per [Client]), which
can be used in conjunction with [Client::open_table] to get a [Table]
instance without the use of [Client::table] constructor directly (e.g., one
created by another [Client]).
§JavaScript Examples
const tables = await client.get_hosted_table_names();
§Python Examples
tables = client.get_hosted_table_names();
§Examples
let tables = client.get_hosted_table_names().await;sourcepub fn set_loop_callback(&self, loop_cb: Py<PyAny>) -> PyResult<()>
pub fn set_loop_callback(&self, loop_cb: Py<PyAny>) -> PyResult<()>
Methods such as [View::on_update] take a callback function as an argument,
which may be invoked by the Perspective runtime when updates occur. If provided
a loop callback function via [Client::set_loop_callback], such callback
function invocations be passed to the loop callback instead.
[Client::set_loop_callback] can be used to control scheduling/conflation
(e.g. by adding a delay), as well as executor integration.
Trait Implementations§
source§impl HasPyGilRef for PySyncClient
impl HasPyGilRef for PySyncClient
§type AsRefTarget = PyCell<PySyncClient>
type AsRefTarget = PyCell<PySyncClient>
source§impl PyClassImpl for PySyncClient
impl PyClassImpl for PySyncClient
source§const IS_BASETYPE: bool = true
const IS_BASETYPE: bool = true
source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
§type ThreadChecker = SendablePyClass<PySyncClient>
type ThreadChecker = SendablePyClass<PySyncClient>
§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
source§impl PyClassNewTextSignature<PySyncClient> for PyClassImplCollector<PySyncClient>
impl PyClassNewTextSignature<PySyncClient> for PyClassImplCollector<PySyncClient>
fn new_text_signature(self) -> Option<&'static str>
source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PySyncClient
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PySyncClient
source§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut PySyncClient
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a mut PySyncClient
source§impl PyMethods<PySyncClient> for PyClassImplCollector<PySyncClient>
impl PyMethods<PySyncClient> for PyClassImplCollector<PySyncClient>
fn py_methods(self) -> &'static PyClassItems
source§impl PyTypeInfo for PySyncClient
impl PyTypeInfo for PySyncClient
source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
source§fn type_object(py: Python<'_>) -> &PyType
fn type_object(py: Python<'_>) -> &PyType
PyTypeInfo::type_object will be replaced by PyTypeInfo::type_object_bound in a future PyO3 versionsource§fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
source§fn is_type_of(object: &PyAny) -> bool
fn is_type_of(object: &PyAny) -> bool
PyTypeInfo::is_type_of will be replaced by PyTypeInfo::is_type_of_bound in a future PyO3 versionobject is an instance of this type or a subclass of this type.source§fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type or a subclass of this type.source§fn is_exact_type_of(object: &PyAny) -> bool
fn is_exact_type_of(object: &PyAny) -> bool
PyTypeInfo::is_exact_type_of will be replaced by PyTypeInfo::is_exact_type_of_bound in a future PyO3 versionobject is an instance of this type.impl DerefToPyAny for PySyncClient
Auto Trait Implementations§
impl Freeze for PySyncClient
impl !RefUnwindSafe for PySyncClient
impl Send for PySyncClient
impl Sync for PySyncClient
impl Unpin for PySyncClient
impl !UnwindSafe for PySyncClient
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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