8000 rust: generated code sometime misses PhantomType instantiations · Issue #204 · adl-lang/adl · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
rust: generated code sometime misses PhantomType instantiations #204
Open
@timbod7

Description

@timbod7

This adl:

struct TabularQueryReq<T> {
  PageReq page = {}; 
};

generates:

#[derive(Clone,Deserialize,Eq,Hash,PartialEq,Serialize)]
pub struct TabularQueryReq<T> {
  #[serde(default="TabularQueryReq::<T>::def_page")]
  pub page: PageReq,

  phantomT: PhantomData<T>,
}

impl<T> TabularQueryReq<T> {
  pub fn new() -> TabularQueryReq<T> {
    TabularQueryReq {
      page: TabularQueryReq::<T>::def_page(),
    }
  }

  pub fn def_page() -> PageReq {
    PageReq{offset : 0_u64, limit : 20_u64}
  }
}

The new() function should initialize the phantomT member.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0