Skip to content

Commit

Permalink
Merge pull request finos#2735 from finos/update-rust-toolchain
Browse files Browse the repository at this point in the history
Support packaging in CI
  • Loading branch information
texodus authored Sep 3, 2024
2 parents d477a58 + f01cf2b commit 384ff64
Show file tree
Hide file tree
Showing 34 changed files with 143 additions and 103 deletions.
1 change: 1 addition & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ frequency = 'never'

[unstable]
bindeps = true
package-workspace = true

[term]
quiet = false
Expand Down
6 changes: 3 additions & 3 deletions .github/actions/install-deps/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,23 +148,23 @@ runs:
uses: dtolnay/rust-toolchain@nightly
if: ${{ inputs.rust == 'true' && inputs.arch != 'aarch64' }}
with:
toolchain: nightly-2024-05-07
toolchain: nightly-2024-08-29
targets: wasm32-unknown-unknown
components: rustfmt, clippy, rust-src

- name: Install rust (aarch64 OSX)
uses: dtolnay/rust-toolchain@nightly
if: ${{ inputs.rust == 'true' && inputs.arch == 'aarch64' && runner.os == 'macOS' }}
with:
toolchain: nightly-2024-05-07
toolchain: nightly-2024-08-29
targets: aarch64-apple-darwin
components: rustfmt, clippy, rust-src

- name: Install rust (aarch64 Linux)
uses: dtolnay/rust-toolchain@nightly
if: ${{ inputs.rust == 'true' && inputs.arch == 'aarch64' && runner.os == 'Linux' }}
with:
toolchain: nightly-2024-05-07
toolchain: nightly-2024-08-29
targets: aarch64-unknown-linux-gnu
components: rustfmt, clippy, rust-src

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

[toolchain]
channel = "nightly-2024-05-07"
channel = "nightly-2024-08-29"
components = ["rustfmt", "clippy", "rust-src"]
targets = ["wasm32-unknown-unknown", "wasm32-unknown-emscripten"]
1 change: 1 addition & 0 deletions rust/bootstrap-runtime/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ use alloc::vec::Vec;

use zune_inflate::DeflateDecoder;

#[allow(unused_unsafe)]
#[global_allocator]
static ALLOCATOR: talc::Talck<talc::locking::AssumeUnlockable, talc::ClaimOnOom> = {
static mut MEMORY: [u8; 64000000] = [0; 64000000];
Expand Down
10 changes: 6 additions & 4 deletions rust/perspective-client/src/rust/config/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ pub struct DefaultStyleAttributes {
pub bool: serde_json::Value,
}

/// The data needed to populate a column's settings. These are typically default
/// values, a listing of possible values, or other basic configuration settings
/// for the plugin. This is the result of calling plugin.plugin_attributes
/// The data needed to populate a column's settings.
///
/// These are typically default values, a listing of possible values, or other
/// basic configuration settings for the plugin. This is the result of calling
/// plugin.plugin_attributes
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub struct PluginAttributes {
pub symbol: Option<SymbolAttributes>,
Expand All @@ -64,4 +66,4 @@ pub struct PluginConfig {
/// Refers to the currently active columns. Maps name to configuration.
#[serde(default)]
pub columns: HashMap<String, serde_json::Value>,
}
}
12 changes: 6 additions & 6 deletions rust/perspective-client/src/rust/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ use crate::{Client, ClientError};
#[cfg(doc)]
use crate::{Table, View};

/// The server-side representation of a connection to a
/// [`Client`]. For each [`Client`] that
/// wants to connect to a `perspective_server::Server`, a dedicated [`Session`]
/// must be created. The [`Session`] handles routing messages emitted by the
/// `perspective_server::Server`ve_server::Server`, as well as owning any
/// resources the [`Client`] may request.
/// The server-side representation of a connection to a [`Client`].
///
/// For each [`Client`] that wants to connect to a `perspective_server::Server`,
/// a dedicated [`Session`] must be created. The [`Session`] handles routing
/// messages emitted by the `perspective_server::Server`ve_server::Server`, as
/// well as owning any resources the [`Client`] may request.
pub trait Session<E> {
/// Handle an incoming request from the [`Client`]. Calling
/// [`Session::handle_request`] will result in the `send_response` parameter
Expand Down
4 changes: 1 addition & 3 deletions rust/perspective-client/src/rust/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ use crate::view::View;
pub type Schema = HashMap<String, ColumnType>;

/// Options which impact the behavior of [`Client::table`], as well as
/// subsequent calls to [`Table::update`], even though this latter method
/// itself does not take [`TableInitOptions`] as an argument, since this
/// parameter is fixed at creation.
/// subsequent calls to [`Table::update`].
#[derive(Clone, Debug, Default, Serialize, Deserialize, TS)]
pub struct TableInitOptions {
#[serde(default)]
Expand Down
11 changes: 6 additions & 5 deletions rust/perspective-js/src/rust/utils/console_logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,12 @@ impl<S: Subscriber + for<'a> LookupSpan<'a>> Layer<S> for WasmLogger {
}
}

/// Configure `WasmLogger` as a global default for tracing. This operation will
/// conflict with any other library which sets a global default
/// `tracing::Subscriber`, so it should not be called when `perspective` is used
/// as a library from a larger app; in this case the app itself should configure
/// `tracing` explicitly.
/// Configure `WasmLogger` as a global default for tracing.
///
/// This operation will conflict with any other library which sets a global
/// default `tracing::Subscriber`, so it should not be called when `perspective`
/// is used as a library from a larger app; in this case the app itself should
/// configure `tracing` explicitly.
pub fn set_global_logging() {
static INIT_LOGGING: OnceLock<()> = OnceLock::new();
INIT_LOGGING.get_or_init(|| {
Expand Down
5 changes: 4 additions & 1 deletion rust/perspective-js/src/rust/utils/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ use std::fmt::Display;
use wasm_bindgen::prelude::*;

/// A bespoke error class for chaining a litany of various error types with the
/// `?` operator. `anyhow`, `web_sys::JsError` are candidates for replacing
/// `?` operator.
///
/// `anyhow`, `web_sys::JsError` are candidates for replacing
/// this, but we'd need a way to get around syntacitc conveniences we get
/// from avoiding orphan instance issues (e.g. converting `JsValue` to an error
/// in `anyhow`).
///
/// We'd still like to implement this, but instead must independently implement
/// the instance for each error, as otherwise `rustc` will complain that the
/// `wasm_bindgen` authors may themselves implement `Error` for `JsValue`.
///
/// ```
/// impl<T> From<T> for ApiError
/// where
Expand Down
4 changes: 3 additions & 1 deletion rust/perspective-js/src/rust/utils/futures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ use wasm_bindgen_futures::{future_to_promise, JsFuture};
use super::errors::*;

/// A newtype wrapper for a `Future` trait object which supports being
/// marshalled to a `JsPromise`, avoiding an API which requires type casting to
/// marshalled to a `JsPromise`.
///
/// This avoids implementing an API which requires type casting to
/// and from `JsValue` and the associated loss of type safety.
#[must_use]
pub struct ApiFuture<T>(Pin<Box<dyn Future<Output = ApiResult<T>>>>)
Expand Down
9 changes: 5 additions & 4 deletions rust/perspective-viewer/src/less/status-bar.less
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,6 @@
flex: 0 1000000 auto;
.button {
height: 22px;
select {
height: 20px;
font-size: var(--label--font-size, 0.75em);
}
}
}

Expand Down Expand Up @@ -295,12 +291,17 @@
}

#theme {
height: 48px;
&:before {
-webkit-mask-image: url("../svg/theme-icon.svg");
mask-image: url("../svg/theme-icon.svg");
}
}

#menu-bar .button select#theme_selector {
height: 48px;
}

.button {
display: inline-flex;
justify-content: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ pub enum DragDropListMsg {
}

/// A sub-selector for a list-like component of a `JsViewConfig`, such as
/// `filters` and `sort`. `DragDropList` is parameterized by two `Component`
/// `filters` and `sort`.
///
/// `DragDropList` is parameterized by two `Component`
/// types, the parent component `T` and the inner item compnent `U`, which must
/// additionally implement `DragDropListItemProps` trait on its own `Properties`
/// associated type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ impl PartialEq for DatetimeColumnStyleProps {
}
}

/// The `ColumnStyle` component stores its UI state privately in its own struct,
/// rather than its props (which has two version of this data itself, the
/// JSON serializable config record and the defaults record).
/// Column style controls for the `datetime` type.
#[derive(Debug)]
pub struct DatetimeColumnStyle {
config: DatetimeColumnStyleConfig,
Expand Down
7 changes: 4 additions & 3 deletions rust/perspective-viewer/src/rust/components/form/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

//! A module for form controls (though form controls like `<Select>` which are
//! also container elements should go in the `containers` module). Components
//! in this module should not be imported from the `components` parent module
//! directly.
//! also container elements should go in the `containers` module).
//!
//! Components in this module should not be imported from the `components`
//! parent module directly.
pub mod code_editor;
pub mod color_range_selector;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ pub enum NumberColumnStyleMsg {
}

/// A `ColumnStyle` component is mounted to the window anchored at the screen
/// position of `elem`. It needs two input configs, the current configuration
/// object and a default version without `Option<>`
/// position of `elem`.
///
/// It needs two input configs, the current configuration object and a default
/// version without `Option<>`
#[derive(Properties)]
pub struct NumberColumnStyleProps {
#[cfg_attr(test, prop_or_default)]
Expand Down Expand Up @@ -97,9 +99,7 @@ impl NumberColumnStyleProps {
}
}

/// The `ColumnStyle` component stores its UI state privately in its own struct,
/// rather than its props (which has two version of this data itself, the
/// JSON serializable config record and the defaults record).
/// A column style form control for `number` columns.
pub struct NumberColumnStyle {
config: NumberColumnStyleConfig,
default_config: NumberColumnStyleDefaultConfig,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ impl PartialEq for StringColumnStyleProps {
}
}

/// The `ColumnStyle` component stores its UI state privately in its own struct,
/// rather than its props (which has two version of this data itself, the
/// JSON serializable config record and the defaults record).
/// A component for the style form control for [`String`] columns.
pub struct StringColumnStyle {
config: StringColumnStyleConfig,
default_config: StringColumnStyleDefaultConfig,
Expand Down
10 changes: 6 additions & 4 deletions rust/perspective-viewer/src/rust/components/style/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛

//! A micro-framework for associating local CSS snippets with `yew::Component`s
//! in a Custom Element's `ShadowRoot`. Embedding a `<LocalStyle>` element
//! will only create the underlying `<style>` tag once (when `Component::view()`
//! is called the first time), even if multiple copies of the `Component`
//! exist in the tree.
//! in a Custom Element's `ShadowRoot`.
//!
//! Embedding a `<LocalStyle>` element will only create the underlying `<style>`
//! tag once (when `Component::view()` is called the first time), even if
//! multiple copies of the `Component` exist in the tree.
//!
//! # Example
//!
//! ```
//! html! {
//! <StyleProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,10 @@ pub struct StyleProviderProps {
}

/// A context which injects any CSS snippet registered within its tree, doing
/// so only once for each unqiue snippet name. CSS can be registered within
/// sub-components via the `<LocalStyle>` component and `css!()` resource
/// inlining macro.
/// so only once for each unqiue snippet name.
///
/// CSS can be registered within sub-components via the `<LocalStyle>` component
/// and `css!()` resource inlining macro.
pub struct StyleProvider {
cache: StyleCache,
}
Expand Down
1 change: 1 addition & 0 deletions rust/perspective-viewer/src/rust/config/columns_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ impl ColumnConfigValues {
}

/// The controls returned by plugin.column_style_controls.
///
/// This is a way to fill out default values for the given controls.
/// If a control is not given, it will not be rendered. I would like to
/// eventually show these as inactive values.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,11 @@ pub struct NumberColumnStyleConfig {

derive_wasm_abi!(NumberColumnStyleConfig, FromWasmAbi, IntoWasmAbi);

/// Exactly like a `ColumnStyleConfig`, except without `Option<>` fields, as
/// this struct represents the default values we should use in the GUI when they
/// are `None` in the real config. It is also used to decide when to omit a
/// field when serialized a `ColumnStyleConfig` to JSON.
/// Exactly like a `ColumnStyleConfig`, except without `Option<>` fields.
///
/// Necessary because this struct represents the default values we should use in
/// the GUI when they are `None` in the real config. It is also used to decide
/// when to omit a field when serialized a `ColumnStyleConfig` to JSON.
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq)]
pub struct NumberColumnStyleDefaultConfig {
pub fg_gradient: f64,
Expand Down
13 changes: 7 additions & 6 deletions rust/perspective-viewer/src/rust/custom_elements/debug_plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ use wasm_bindgen::prelude::*;
use crate::utils::*;
use crate::*;

/// The `<perspective-viewer-plugin>` element, the default perspective plugin
/// which is registered and activated automcatically when a
/// `<perspective-viewer>` is loaded without plugins. While you will not
/// typically instantiate this class directly, it is simple enough to function
/// as a good "default" plugin implementation which can be extended to create
/// custom plugins.
/// The `<perspective-viewer-plugin>` element.
///
/// The default perspective plugin which is registered and activated
/// automcatically when a `<perspective-viewer>` is loaded without plugins.
/// While you will not typically instantiate this class directly, it is simple
/// enough to function as a good "default" plugin implementation which can be
/// extended to create custom plugins.
///
/// # Example
/// ```javascript
Expand Down
6 changes: 4 additions & 2 deletions rust/perspective-viewer/src/rust/custom_elements/modal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ use crate::utils::*;
type BlurHandlerType = Rc<RefCell<Option<Closure<dyn FnMut(FocusEvent)>>>>;

/// A `ModalElement` wraps the parameterized yew `Component` in a Custom
/// Element. Via the `open()` and `close()` methods, a `ModalElement` can be
/// positioned next to any existing on-page elements, accounting for viewport,
/// Element.
///
/// Via the `open()` and `close()` methods, a `ModalElement` can be positioned
/// next to any existing on-page elements, accounting for viewport,
/// scroll position, etc.
///
/// `#[derive(Clone)]` generates the trait bound `T: Clone`, which is not
Expand Down
2 changes: 2 additions & 0 deletions rust/perspective-viewer/src/rust/exprtk/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
use perspective_client::ExprValidationError;
use yew::prelude::*;

/// A tokenizer cursor for ExprTK parsing.
///
/// Because ExprTK reports errors in column/row coordinates and visually needs
/// to be applied to an entire token rather than a single character, we need
/// fairly obnoxious counter logic to figure out how to generate the resulting
Expand Down
9 changes: 5 additions & 4 deletions rust/perspective-viewer/src/rust/exprtk/tokenize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ use self::number::*;
use self::string::*;
use self::symbol::*;

/// Syntax-highlightable ExprTK tokens. We had the option of implemnting this
/// alternatively as `pub struct Token(TokenType, &'a str);`, but I felt this
/// was less ergonomic for the frequent pattern matching necessary when handling
/// enum tokens.
/// Syntax-highlightable ExprTK tokens.
///
/// We had the option of implemnting this alternatively as `pub struct
/// Token(TokenType, &'a str);`, but I felt this was less ergonomic for the
/// frequent pattern matching necessary when handling enum tokens.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Token<'a> {
Comment(&'a str),
Expand Down
6 changes: 4 additions & 2 deletions rust/perspective-viewer/src/rust/js/testing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ extern "C" {

/// A macro which set a property called `weak_link` on the container
/// `Properties` when `cfg(test)`, such that unit tests may send messages to a
/// component. This macro needs to be called in `create()` on any Component
/// which needs to receive messages in a test.
/// component.
///
/// This macro needs to be called in `create()` on any Component which needs to
/// receive messages in a test.
#[macro_export]
macro_rules! enable_weak_link_test {
($props:expr, $link:expr) => {
Expand Down
Loading

0 comments on commit 384ff64

Please sign in to comment.