Move `MaxEncodedLen` from Substrate (#268)

* move MaxEncodedLen trait from Substrate

* Move derive macro and tests from Substrate

* only run ui tests when derive feature enabled

* reduce note-taking documentation

Co-authored-by: Bastian Köcher <>

* Bless trybuild `tests/max_encoded_len_ui/` test

* Update docs (these files are not part of substrate)

Co-authored-by: Andronik Ordian <>

* Mention new `MaxEncodedLen` trait in the

* Prepare a 2.2.0-rc.1 release

This is a pre-release rather than a full release in order to help shape
the new `MaxEncodedLen` trait used in Substrate in case some more
involved changes are found out to be required.
The API did not change since its introduction until now so chances are
slim but it's good to leave some leeway.

* incorporate changes made to Substrate version of MaxEncodedLen

Note: doesn't include the MaxEncodedLen impl for H160, H256, H512.
A substrate companion will be necessary to re-add those.

* remove redundant no_std

* Rewrite fn max_encoded_len_trait for clarity

* simplify logic checking for invalid attr

Co-authored-by: Bastian Köcher <>

* remove bogus whitespace

Co-authored-by: Bastian Köcher <>

* use Path::is_ident() helper

Co-authored-by: Bastian Köcher <>

* rm unused import

Co-authored-by: Bastian Köcher <>
Co-authored-by: Igor Matuszewski <>
Co-authored-by: Andronik Ordian <>
9 jobs for master in 19 minutes and 47 seconds (queued for 3 seconds)