Coder Social home page Coder Social logo

Remove PhantomData about scale-info HOT 3 CLOSED

ascjones avatar ascjones commented on July 26, 2024
Remove PhantomData

from scale-info.

Comments (3)

ascjones avatar ascjones commented on July 26, 2024 2

I believe the idea is that any fields which are PhantomData are not even included in a type definition at all (since they have no encoded representation in SCALE). @Robbepop might elaborate more what he means.

from scale-info.

Robbepop avatar Robbepop commented on July 26, 2024

Probably will need to update derive macro to skip over PhantomData fields.

Note that checks like these should always happen on a type level, never on a syntactical level so this will get a bit more involved in a proc. macro. You might be in need of additional helper traits to help in this process.

from scale-info.

dvdplm avatar dvdplm commented on July 26, 2024

Do I understand this correctly? We want this:

scale-info/src/tests.rs

Lines 71 to 77 in 4188f02

assert_type!(
PhantomData<i32>,
Type::builder()
.path(Path::prelude("PhantomData"))
.type_params(tuple_meta_type!(i32))
.composite(Fields::unit())
);

…to be this:

	assert_type!(
		i32,
		Type::builder()
			.path(Path::prelude("PhantomData"))
			.type_params(tuple_meta_type!(i32))
			.composite(Fields::unit())
	);

(and pass, naturally)?

from scale-info.

Related Issues (20)

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.