Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optref, error, bytes, hex #1

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open

Conversation

turuslan
Copy link
Contributor

@turuslan turuslan commented Nov 8, 2023

  • Utils library for KAGOME and Libp2p kagome#1813
  • Outcome<T>, Errors, Error, Q_ERROR, Q_TRY
    • outcome::result<T>, OUTCOME_TRY
  • OptRef<T>
  • (libp2p) Bytes, BytesN<N>, BytesIn, BytesOut
  • (hexutil) fmt "{}" = "0x0102…0506", "{:x}" = "010203040506", "{:0x}" = "0x010203040506"

#define Q_ERROR_LOCATION \
(::qtils::ErrorLocation{__PRETTY_FUNCTION__, __FILE__, __LINE__})

#define Q_ERROR(error_) (::qtils::Error{Q_ERROR_LOCATION, error_})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#define Q_ERROR(error_) (::qtils::Error{Q_ERROR_LOCATION, error_})
#define Q_ERROR(error_) (::qtils::Error{Q_ERROR_LOCATION, (error_)})

Copy link
Contributor Author

@turuslan turuslan Nov 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an error here (MUL(a,b)a*b; ADD(2+3,4+5); 2+3*4+5)

src/qtils/hex.hpp Outdated Show resolved Hide resolved
src/qtils/move.hpp Show resolved Hide resolved
Copy link

@Harrm Harrm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/qtils -> include/qtils ?

};

/**
* Used by `OptRef` to reset `T *` on move.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please comment with more details.


namespace qtils {
/**
* Used to reset `std::coroutine_handle` on move.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please comment with more details.

Comment on lines +25 to +26
const char *fn;
const char *file;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string_view?

Copy link
Contributor Author

@turuslan turuslan Nov 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't want to increase sizeof(ErrorLocation),
these macro strings are always zero terminated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants