trunk | Build , bundle & ship your Rust WASM application to the web
kandi X-RAY | trunk Summary
kandi X-RAY | trunk Summary
Build, bundle & ship your Rust WASM application to the web. Trunk is a WASM web application bundler for Rust. Trunk uses a simple, optional-config pattern for building & bundling WASM, JS snippets & other assets (images, css, scss) via a source HTML file. Dev server - Trunk ships with a built-in server for rapid development workflows, as well as support for HTTP & WebSocket proxies. Change detection - Trunk watches your application for changes and triggers builds for you. Browser reloading, HMR, and other related features are in-progress.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of trunk
trunk Key Features
trunk Examples and Code Snippets
Community Discussions
Trending Discussions on trunk
QUESTION
Consider the following which uses the ternary operator to get the common function pointer type of the two lambdas
...ANSWER
Answered 2022-Apr-11 at 10:40Both, say the same thing, you can't use ternary operator on different types. Lambda functions must have identical format
QUESTION
This works and outputs "1", because the function's constraints are partially ordered and the most constrained overload wins:
...ANSWER
Answered 2022-Mar-29 at 18:45C++20 recognizes that there can be different spellings of the same effective requirements. So the standard defines two concepts: "equivalent" and "functionally equivalent".
True "equivalence" is based on satisfying the ODR (one-definition rule):
Two expressions involving template parameters are considered equivalent if two function definitions containing the expressions would satisfy the one-definition rule, except that the tokens used to name the template parameters may differ as long as a token used to name a template parameter in one expression is replaced by another token that names the same template parameter in the other expression.
There's more to it, but that's not an issue here.
Equivalence for template heads includes that all constraint expressions are equivalent (template headers include constraints).
Functional equivalence is (usually) about the results of expressions being equal. For template heads, two template heads that are not ODR equivalent can be functionally equivalent:
Two template-heads are functionally equivalent if they accept and are satisfied by ([temp.constr.constr]) the same set of template argument lists.
That's based in part on the validity of the constraint expressions.
Your two template heads in versions 1 and 3 are not ODR equivalent, but they are functionally equivalent, as they both accept the same template parameters. And the behavior of that code will be different from its behavior if they were ODR equivalent. Therefore, this passage kicks in:
If the validity or meaning of the program depends on whether two constructs are equivalent, and they are functionally equivalent but not equivalent, the program is ill-formed, no diagnostic required.
As such, all of the compilers are equally right because your code is wrong. Obviously a compiler shouldn't straight-up crash (and that should be submitted as a bug), but "ill-formed, no diagnostic required" often carries with it unforeseen consequences.
QUESTION
If I run git fetch origin
and then git checkout
on a series of consecutive commits, I get a relatively small repo directory.
But if I run git fetch origin
and then git checkout FETCH_HEAD
on the same series of commits, the directory is relatively bloated. Specifically, there seem to be a bunch of large packfiles.
The behavior appears the same whether the commits are all in place at the time of the first fetch
or if they are committed immediately before each fetch.
The following examples use a public repo, so you can reproduce the behavior.
Why is the directory size of example 2 so much larger?
Example 1 (small):
...ANSWER
Answered 2022-Mar-25 at 19:08Because each fetch produces its own packfile and one packfile is more efficient than multiple packfiles. A lot more efficient. How?
First, the checkouts are a red herring. They don't affect the size of the .git/ directory.
Second, in the first example only the first git fetch origin
does anything. The rest will fetch nothing (unless something changed on origin).
Compression works by finding common long sequences within the data and reducing them to very short sequences. If
long block of legal mumbo jumbo
appears dozens of times it could be replaced with a few bytes. But the original long string must still be stored. If there's a single packfile it must only be stored once. If there's multiple packfiles it must be stored multiple times. You are, effectively, storing the whole history of changes up to that point in each packfile.
We can see in the example below that the first packfile is 113M, the second is 161M, the third is 177M, and the final fetch is 209M. The size of the final packfile is roughly equal to the size of the single garbage compacted packfile.
Why do multiple fetches result in multiple packfiles?git fetch
is very efficient. It will only fetch objects you not already have. Sending individual object files is inefficient. A smart Git server will send them as a single packfile.
When you do a single git fetch
on a fresh repository, Git asks the server for every object. The remote sends it a packfile of every object.
When you do git fetch ABC
and then git fetch DEF
s, Git tells the server "I already have everything up to ABC, give me all the objects up to DEF", so the server makes a new packfile of everything from ABC to DEF and sends it.
Eventually your repository will do an automatic garbage collection and repack these into a single packfile.
We can reduce the examples. I'm going to use Rails to illustrate because it has clearly defined tags to fetch.
QUESTION
namespace N {
struct A {};
template
constexpr bool operator<(const T&, const T&) { return true; }
}
constexpr bool operator<(const N::A&, const N::A&) { return false; }
#include
int main() {
static_assert(std::less{}({}, {}), "assertion failed");
}
...ANSWER
Answered 2022-Mar-05 at 16:30What matters here is whether the unqualified lookup from inside std
finds any other operator<
(regardless of its signature!) before reaching the global namespace. That depends on what headers have been included (any standard library header may include any other), and it also depends on the language version since C++20 replaced many such operators with operator<=>
. Also, occasionally such things are respecified as hidden friends that are not found by unqualified lookup. It’s obviously unwise to rely on it in any case.
QUESTION
This is about the correct diagnostics when short int
s get promoted during "usual arithmetic conversions". During operation /
a diagnostic could be reasonably emitted, but during /=
none should be emitted.
Behaviour for gcc-trunk and clang-trunk seems OK (neither emits diagnostic for first or second case below)... until...
we add the entirely unrelated -fsanitize=undefined
... after which, completely bizarrely:
gcc-trunk emits a diagnostic for both cases. It really shouldn't for the 2nd case, at least.
Is this a bug in gcc?
...ANSWER
Answered 2022-Feb-19 at 16:30For a built-in compound assignment operator $=
the expression A $= B
behaves identical to an expression A = A $ B
, except that A
is evaluated only once. All promotions and other usual arithmetic conversions and converting back to the original type still happen.
Therefore it shouldn't be expected that the warnings differ between short avg1 = sum / count;
and tmp /= count;
.
A conversion from int
to short
happens in each case. So a conversion warning would be appropriate in either case.
However, the documentation of GCC warning flags says specifically that conversions back from arithmetic on small types which are promoted is excluded from the -Wconversion
flag. GCC offers the -Warith-conversion
flag to include such cases nonetheless. With it all arithmetic in your examples generates a warning.
Also note that this exception to -Wconversion
has been introduced only with GCC 10. For some more context on it, the bug report from which it was introduced is here.
It seems that Clang has always been more lenient on these cases than GCC. See for example this issue and this issue.
For /
in GCC -fsanitize=undefined
seems to break the exception that -Wconversion
is supposed to have. It seems to me that this is related to the undefined behavior sanitizer adding a null-value check specifically for division. Maybe, after this transformation, the warning flag logic doesn't recognize it as direct arithmetic on the smaller type anymore.
If my understanding of the intended behavior of the warning flags is correct, I would say that this looks unintended and thus is a bug.
QUESTION
Could the problem be that Android Studio can't find the path to CocoaPods?
I'm trying to test my app on my iPhone from Android Studio. The error I get is
...ANSWER
Answered 2022-Jan-31 at 17:27A response on IssueTracker says
This problem is present with Android Studio Bumblebee on Mac. Launching flutter from the IDE causes this issue where it can't find the Cocoapods path.
Forced to run flutter from terminal for it to work.
Here's how run your project from the CLI on the iOS simulator. cd
into your project directory and run:
QUESTION
Sample code:
...ANSWER
Answered 2022-Jan-11 at 20:28From the clang manual:
Because default argument promotion only applies to the standard floating-point types,
_Float16
values are not promoted todouble
when passed as variadic or untyped arguments. As a consequence, some caution must be taken when using certain library facilities with_Float16
; for example, there is noprintf
format specifier for_Float16
, and (unlikefloat
) it will not be implicitly promoted todouble
when passed toprintf
, so the programmer must explicitly cast it to double before using it with an%f
or similar specifier.
QUESTION
I was testing this code (https://godbolt.org/z/fe6hhbeqW)...
...ANSWER
Answered 2022-Jan-29 at 13:14It doesn't matter that i
is guaranteed to be evaluated only at compile-time when its value is known in an abstract sense.
It also doesn't matter whether the function is consteval
or constexpr
or none of these.
The language is still statically typed and nth_type_t;
must in any given instantiation of the function refer to exactly one type. If i
can change in the for
loop, that is not possible to guarantee.
The language requires that the expression i
when used as template argument is by itself a constant expression, independently of whether the whole function body can only be evaluated as part of a larger constant expression. But i
is neither declared constexpr
, nor declared const
with constant initializer.
QUESTION
Discussion about this was started under this answer for quite simple question.
ProblemThis simple code has unexpected overload resolution of constructor for std::basic_string
:
ANSWER
Answered 2022-Jan-05 at 12:05Maybe I'm wrong, but it seems that last part:
QUESTION
In my gitlab CI I always get this hint messages. Yes, I see I have to set git config --global init.defaultBranch main
, but everything I'm adding in my stages / jobs of the CI gitlab config is executed after fetching.
ANSWER
Answered 2022-Jan-13 at 16:37As far as i experienced, the only way to disable this message is to set the config globally in the .gitconfig
of the user running the gitlab-runner.
This can either be done on the underlying VM if you use the shell-runner or inside the used docker-image when using the docker-runner
Update
Altough it says global
, the git-setting is user based. You'll have to set it as the same user that executes the gitlab-runner.
Depending on the configuration, this might be gitlab-runner
or a custom user on shell-runners or root
when using the docker-executor.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install trunk
Install
App Setup
Assets
Configuration
CLI Commands
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page