Skip to content

Updating editable  #1

Description

@Cambyst

Hi Team,

Thank you for the great project ! I was wondering if you had an example of adding "editable" to a mutable attribute (for example list) and updating the value without cloning it ?

Many thanks in advance !

For instance, in example.graph:

node X -> O { #[editable = "true"] x: list<i32>, }

We could the below but it is expensive as it is cloning the x attribute:
`
impl Runnable<Request, EResponse> for X {
type Resp = XResponse;
type Error = ();

async fn run(&self, req: Request, prev_resp: EResponse) -> Result<Self::Resp, Self::Error> {
    tokio::time::sleep(prev_resp.0).await;
    let mut old_vec = self.x.load().to_vec();
    old_vec.push(req.user_age);
    self.x.store(Arc::new(old_vec));
    Ok(XResponse(!req.msg.contains('*')))
}

}`

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions