Code Monkey home page Code Monkey logo

iced_dynamic_view_mod's Introduction

dynamic view module iced example

What is this?

Some people were wondering about how to speed up incremental iced builds. Because iced uses the elm architecture it's state is nicely encapsulated and modifiable in the the runtimes calls to application::view. We can leverage this to dynamically recompile and relink just the view function, this could save us time by avoiding relinking larger dependencies which might include tungstenite or plotters, or libraries that make heavy use of proc macros.

how do I run it?

  1. build the dylib in view_mod with cargo build.
  2. call cargo run in the main crate.
  3. make changes to the view mod, build it again, do anything which sends a message, watch the UI update.

Does it really improve iteration time?

No, not in most cases, but it really could given a few minor changes.

  1. with the addition of a dynamic backend to iced we could pass a box<dyn Renderer> to the dylib and not have to relink wgpu, gfx, lyon, etc. every time we rebuild the dylib. The renderer trait must be implemented by a sized type. this idea for speeding up dynamically linked builds is out the window.
  2. Iced is lazy in it's calls to view, so refreshing requires the view to be updated, writing a subscriber that watches file events and calls dymod::reload would also be ideal.
  3. this is actually a lot of hassle.

Goals

ideally a dynamic backend to iced would build in less that 2 seconds allowing for really HTML equivalent iteration speeds.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.